Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Aragorn

macrumors newbie
Original poster
Jan 9, 2004
10
0
Hey, I'm new to posting, but have been reading the forums for about a year now. I am taking a summer C++ programming class and I need a way to compile my program on a mac. The class tells me how to do it on a Windows machine, but I would like to have my program work on my Mac. In windows I need to type in a compile command like this:

bgi++ -Wall sample.c -o nameofprogram

Is there a way to do this in the terminal, and if so do I need any special programs. I dont really care if I can send in my program, I just email the code for my homework. I just need it to compile and run on my computer. Any help would be great. Thanks.
 
Aragorn said:
Hey, I'm new to posting, but have been reading the forums for about a year now. I am taking a summer C++ programming class and I need a way to compile my program on a mac. The class tells me how to do it on a Windows machine, but I would like to have my program work on my Mac. In windows I need to type in a compile command like this:

bgi++ -Wall sample.c -o nameofprogram

Is there a way to do this in the terminal, and if so do I need any special programs. I dont really care if I can send in my program, I just email the code for my homework. I just need it to compile and run on my computer. Any help would be great. Thanks.

Here you go. xcode includes gcc 3.3

http://developer.apple.com/tools/xcode/

link to the gcc documentation - http://gcc.gnu.org/onlinedocs/
 
Well it looks like the g++ code is working, but do I need to save my file as a .cpp? If so how do I do that? Should I use textedit, word or some other text software to save my files?
 
Aragorn said:
Well it looks like the g++ code is working, but do I need to save my file as a .cpp? If so how do I do that? Should I use textedit, word or some other text software to save my files?

Well, since you are going to be using the command line instead of something like, say, Xcode, why not use a command line text editor? Mac OS X comes with vim, emacs, pico, and I'm sure some others I don't know about.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.