Basic c++ class. Need free compiler

Discussion in 'Mac Programming' started by Yezman, Sep 12, 2011.

  1. Yezman macrumors newbie

    Jul 21, 2011
    So I am taking a c++ class and am in need of a compiler that is free. I looked up xcode 4, but it get that I have to have 10.7 (i have 10.6.7) from what I read (in the app store).

    Can anyone lead me to a free c++ compiler for 10.6.7, nothing special just a "basic" one will do.

  2. dukebound85 macrumors P6


    Jul 17, 2005
    5045 feet above sea level
    get xcode 3.x.x or whatever. It's free on the apple site
  3. xStep macrumors 68000

    Jan 28, 2003
    Less lost in L.A.
    Or just install it from the install DVDs that came with the Mac. I agree the latest version of Xcode 3 would be the better choice.
  4. EthanMiller macrumors member

    Aug 15, 2011
    Or just go to the terminal, cd to the directory, and type "g++ filename.cpp" without the quotes. The compiled file will be a.out in the working directory.

    If you need help with any of that, google is a good resource.

    cd is the change directory command. ~ represents your home directory, so if you wanted to go to the Dev folder in your Documents folder, you'd type "cd ~/Documents/Dev" and press enter (no quotes). If you ever want more, man opens the manual - "man cd" tells you about the cd command.

    Other useful ones are ls to list the contents of a directory, pwd to print the working directory (tell you where you are, basically), and open to open a file in it's default editor (Probably TextEdit for cpp files, but I do most of my editing in vi).

    Hope that's helpful!
  5. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    g++ isn't installed by default. It's only installed with Xcode (Dev Tools), or if you take some other action to obtain it elsewhere. Same goes for gcc and a lot of other developer tools.

Share This Page