PDA

View Full Version : help with compiling c++ code please!!




waterskier2007
Oct 25, 2007, 11:09 AM
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



yellow
Oct 25, 2007, 11:11 AM
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

waterskier2007
Oct 25, 2007, 11:17 AM
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
Oct 25, 2007, 11:20 AM
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

MongoTheGeek
Oct 25, 2007, 11:20 AM
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

GCC comes with Xcode.

There is a free level of ADC membership. You give them your email address and click through an EULA.

waterskier2007
Oct 25, 2007, 11:26 AM
GCC comes with Xcode.

There is a free level of ADC membership. You give them your email address and click through an EULA.

i found that thanks. thanks for the help

satyam90
Oct 26, 2007, 12:20 AM
i don't think xcode tools are necessary on linux. try gcc, g++, c++ etc.....depending on what compiler u are using.