C++ in terminal

Discussion in 'Mac Apps and Mac App Store' started by Aragorn, Jun 10, 2004.

  1. Aragorn macrumors newbie

    Joined:
    Jan 9, 2004
    #1
    Hey, I'm new to posting, but have been reading the forums for about a year now. I am taking a summer C++ programming class and I need a way to compile my program on a mac. The class tells me how to do it on a Windows machine, but I would like to have my program work on my Mac. In windows I need to type in a compile command like this:

    bgi++ -Wall sample.c -o nameofprogram

    Is there a way to do this in the terminal, and if so do I need any special programs. I dont really care if I can send in my program, I just email the code for my homework. I just need it to compile and run on my computer. Any help would be great. Thanks.
     
  2. belf8st macrumors member

    Joined:
    Feb 10, 2004
    #2
    Here you go. xcode includes gcc 3.3

    http://developer.apple.com/tools/xcode/

    link to the gcc documentation - http://gcc.gnu.org/onlinedocs/
     
  3. GeeYouEye macrumors 68000

    GeeYouEye

    Joined:
    Dec 9, 2001
    Location:
    State of Denial
  4. Mitthrawnuruodo Moderator emeritus

    Mitthrawnuruodo

    Joined:
    Mar 10, 2004
    Location:
    Bergen, Norway
    #4
    I agree with GeeYouEye, do the g++ (or gcc or c++) command from terminal...

    What does the -Wall flag do, I've never seen it before...
     
  5. ElCrazon macrumors newbie

    Joined:
    May 15, 2004
  6. Aragorn thread starter macrumors newbie

    Joined:
    Jan 9, 2004
    #6
    Well it looks like the g++ code is working, but do I need to save my file as a .cpp? If so how do I do that? Should I use textedit, word or some other text software to save my files?
     
  7. NuPowerbook macrumors member

    Joined:
    Jan 17, 2004
    #7
    Well, since you are going to be using the command line instead of something like, say, Xcode, why not use a command line text editor? Mac OS X comes with vim, emacs, pico, and I'm sure some others I don't know about.
     

Share This Page