help with compiling c++ code please!!

Discussion in 'Mac Programming' started by waterskier2007, Oct 25, 2007.

  1. macrumors 68000

    waterskier2007

    Joined:
    Jun 19, 2007
    Location:
    White Lake, MI
    #1
    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
     
  2. Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #2
    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
     
  3. thread starter macrumors 68000

    waterskier2007

    Joined:
    Jun 19, 2007
    Location:
    White Lake, MI
    #3
    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
     
  4. Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #4
    Guess you missed the "Sign up for free ADC online membership" ad in the corner.

    B
     
  5. macrumors 68040

    MongoTheGeek

    Joined:
    Sep 13, 2003
    Location:
    Its not so much where you are as when you are.
    #5
    GCC comes with Xcode.

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

    waterskier2007

    Joined:
    Jun 19, 2007
    Location:
    White Lake, MI
    #6
    i found that thanks. thanks for the help
     
  7. macrumors regular

    satyam90

    Joined:
    Jul 30, 2007
    Location:
    Bangalore, India
    #7
    i don't think xcode tools are necessary on linux. try gcc, g++, c++ etc.....depending on what compiler u are using.
     

Share This Page