Mac gcc


macrumors P6
Original poster
Jul 17, 2005
5045 feet above sea level
How do I begin to write in c++? Where is gcc? Is it in xcode the app or where? Also, I write the program in text edit and then compile it in gcc right? Thanks for any help


macrumors 6502a
Apr 29, 2005
gcc should be installed when you install the Developer Tools from the Apple installation disk. It should be at /usr/bin/gcc

I havn't used xcode for anything really other than light modification to system files, so I can't comment on that.

If your comfortable in Terminal, you can create your c file with vim or some editor, save it as 'whatever.c' then 'gcc whatever.c' and it should (assuming no major errors in the code) create a file called a.out which is your executable to be run. Which can be ran by typing './a.out'


macrumors 6502
Dec 22, 2004
C-ville, VA
gcc is actually the GNU C compiler. I do believe if you compile from the command line you will have to specify the c++ (for c++, naturally) compiler which is g++. At least, when I coded c++ in linux, I had to do this to avoid the compiler erroring out. XCode should differentiate this for you if you use it.