gcc

Discussion in 'Mac Programming' started by dukebound85, Jul 29, 2005.

  1. dukebound85 macrumors P6

    dukebound85

    Joined:
    Jul 17, 2005
    Location:
    5045 feet above sea level
    #1
    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
     
  2. tag macrumors 6502a

    tag

    Joined:
    Apr 29, 2005
    Location:
    PA, US
    #2
    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'
     
  3. jim. macrumors 6502

    Joined:
    Dec 22, 2004
    Location:
    C-ville, VA
    #3
    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.

    Jim
     
  4. dukebound85 thread starter macrumors P6

    dukebound85

    Joined:
    Jul 17, 2005
    Location:
    5045 feet above sea level

Share This Page