[Emacs + Gcc on windows] - Computers



Search Tech-Forums - link takes you to our Forum's search page.

Note: The following is only a text archive!


To view the actual forum discussion, please visit our website at http://www.tech-forums.net

Pages:1



Emacs + Gcc on windows

(Click here to view the original thread with full colors/images)



Posted by: Hi.Im.New

So i installed cygwin / emacs , but cant get emacs to compile code via emacs... also when i do compile code , i for example tried helloworld.cpp it compiles , but cant see output from it... was wondering if anyone could help.
thx,
j



Posted by: williwaw

I have not seen your code, but I am guessing that you're forgetting: [color=red]system("Pause");[/color]


[code]
#include <iostream>
#include <stdlib.h>

using namespace std;

int main(int argc, char *argv[])
{
cout<<"helloworld.cpp \n";
[color=red]system("PAUSE");[/color]
return 0;
}
[/code]

Cheers,
Williwaw
[IMG]http://i4.photobucket.com/albums/y132/williwaw/thLavaLampSmall_anim.gif[/IMG]

Oops, never mind...I have no clue what you are talking about:)



Posted by: void

How are you trying to compile in emacs, is it via the shell compile. So its M-! (Alt + Shift + 1), then typing
[CODE]gcc helloworld.c -o helloworld.exe
or for C++
g++ helloworld.cpp -o helloworld.exe[/CODE]
Or write a makefile and in the shell type something like
[CODE]make build[/CODE]



Posted by: Hi.Im.New

Yea it's through the shell , im just trying to be able to compile via emacs with the gcc compiler and it doesnt do anything. I'm pretty new at emacs and not sure if i have to change something in a config file. Also when i just plain compile it via the bash shell that cygwin gives me it compiles into an exe but when double click or try to run it nothing happens. Just alittle confused is all. My biggest concern is nothing being able to see any output of any program i write.

j



Posted by: jaeusm

[QUOTE]My biggest concern is nothing being able to see any output of any program i write.[/QUOTE]
If you are just double clicking the executable, the OS owns the output window, not you. It executes your program, displays your output to a window, and then promptly closes it before you have a chance to examine it.

Open a command prompt, navigate to your program, and run it from there. You should see the output, provided your program does what you think it should.

Your other option is to add a line of code to your program causing the window to stay open, like waiting for the user to enter a character.



Posted by: void

You run your program as
[CODE]./helloworld.exe[/CODE]
either via emacs or directly in the shell.



Posted by: Hi.Im.New

Yea when i try to run the exe by double clicking it it says:
"This application has failed to start because cygwin1.dll was not found."

Void thnx for clearing that up for me with the bash command line execution. Im new to bash and want to get better. Another question I have about emacs is customization of it. Is there anything i can download to make it easier to code in. Cause its all the same color, i still dont know how to make the compiler in emacs work though.

Also does anyone know a free makefile generator program such as gmakemake ro anything like that i could dl?

j



Posted by: void

Syntax highlighting is F10 (to access the menu bar) then o for options and s for Syntax highlighting.

If you haven't do so already you should do the emacs tutorial, its very helpful. Via the menu its F10, then h for Help and e for Emacs tutorial.

As for cygwin1.dll, it acts as a Linux API emulation layer and you programs rely on it. The flag for GCC to link against the Windows dll is -mno-cygwin





vBulletin Copyright ©2000 - 2003, Jelsoft Enterprises Limited.


PPC Management
vB Easy Archive Final - Created by Xenon