Mac help with compiling c++ code please!!

waterskier2007

macrumors 68000
Original poster
Jun 19, 2007
1,815
145
Novi, MI
I need some help and i found an old thread but i couldnt really make heads nor tails of it. I am a college student, and today in lecture we used the terminal in Linux for the first time to compile a C++ code and run it. i asked the GSI, who i know is a mac user if the same commands would work in Mac Terminal and he said they should. I cant figure out how to compile the file. for this example the filename is

sawTooth.cpp

we were given the code g++ sawTooth.cpp -o sawTooth

in order to compile the file. i am trying to type this into terminal but i get a response that g++ is not a recognized command. if anyone could help with ways to compile a file that would be great
 

waterskier2007

macrumors 68000
Original poster
Jun 19, 2007
1,815
145
Novi, MI
That's because you have to install the GNU C Compiler on your Mac before you can compile anything.

Download the latest verison of XCode Tools (for free) from http://developer.apple.com
when i go to that site and look for xcode, the only thing i see is a xcode 2.4.1 which states that it is free for ADC members only, is it possible that i am viewing the wrong thing
 

balamw

Moderator
Staff member
Aug 16, 2005
19,368
978
New England
when i go to that site and look for xcode, the only thing i see is a xcode 2.4.1 which states that it is free for ADC members only, is it possible that i am viewing the wrong thing
Guess you missed the "Sign up for free ADC online membership" ad in the corner.

B
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.