Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 01-29-2007, 05:42 PM   #1 (permalink)
Hi.Im.New's Avatar
 
True Techie

Join Date: Dec 2004

Posts: 113

Hi.Im.New is on a distinguished road

Default Emacs + Gcc on windows

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
Hi.Im.New is offline  
Old 01-29-2007, 10:23 PM   #2 (permalink)
 
Banned

Join Date: Oct 2006

Posts: 81

williwaw

Default

I have not seen your code, but I am guessing that you're forgetting: system("Pause");


Code:
#include <iostream>
#include <stdlib.h>

using namespace std;

int main(int argc, char *argv[])
{
  cout<<"helloworld.cpp \n";
  system("PAUSE");	
  return 0;
}
Cheers,
Williwaw


Oops, never mind...I have no clue what you are talking about
williwaw is offline  
Old 01-30-2007, 03:55 AM   #3 (permalink)
void's Avatar
 
True Techie

Join Date: Oct 2005

Posts: 198

void

Default

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
Or write a makefile and in the shell type something like
Code:
make build

void is offline  
Old 01-30-2007, 01:04 PM   #4 (permalink)
Hi.Im.New's Avatar
 
True Techie

Join Date: Dec 2004

Posts: 113

Hi.Im.New is on a distinguished road

Default

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
Hi.Im.New is offline  
Old 01-30-2007, 01:36 PM   #5 (permalink)
 
Software Developer

Join Date: Mar 2006

Location: Columbus, OH

Posts: 569

jaeusm is on a distinguished road

Default

Quote:
My biggest concern is nothing being able to see any output of any program i write.
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.
jaeusm is offline  
Old 01-30-2007, 03:45 PM   #6 (permalink)
void's Avatar
 
True Techie

Join Date: Oct 2005

Posts: 198

void

Default

You run your program as
Code:
./helloworld.exe
either via emacs or directly in the shell.
void is offline  
Old 01-30-2007, 04:24 PM   #7 (permalink)
Hi.Im.New's Avatar
 
True Techie

Join Date: Dec 2004

Posts: 113

Hi.Im.New is on a distinguished road

Default

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
Hi.Im.New is offline  
Old 01-30-2007, 06:12 PM   #8 (permalink)
void's Avatar
 
True Techie

Join Date: Oct 2005

Posts: 198

void

Default

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
void is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On