Results 1 to 3 of 3

Thread: C++ in terminal

  1. #1

    Member Since
    Apr 01, 2008
    Question C++ in terminal
    Hi everyone,

    I'm really new to everything, I just started using the terminal about a week ago and yesterday I started a c++ course in uni.
    I'm don't even know if this is the right forum but my terminal says "Welcome to Darwin" so I figured the clue is in the title...

    I'd like to try the things we do at uni at home with my mac, but I have a few problems getting everything to run.

    At uni we use solaris and also work via a terminal.

    To open a new file with an editor we either type

    emacs also opens in the terminal, but it looks really different and I can't figure out how to save a file or anythiing else for that matter (please don't laugh..)

    I think I managed to somehow create a file anyhow, but I can't compile the program with g++ (in uni we just use
    g++ -c

    I've read that there is supposed to be some gcc compiler in the terminal, but how does it work?

    I'd really like to use the terminal for these things and I don't want to get started with xcode yet, because I want to keep things similar to what we do at uni.

    Any help would be much appreciated!


  2. #2

    novicew's Avatar
    Member Since
    Jan 04, 2006
    Hamburg, Germany
    MacBook Pro | iMac(2.1 G5) | MacBook(2.16 C2D) | MacMini (1.67 CD) | iPhone 4 | iPad (3rd Gen)
    Check whether you have g++ compiler installed.
    Open the Terminal, type g++ -v and hit return.
    This should provide you information on g++. If it is not giving any output, install xCode. That should provide all the tools that you need.

    To compile
    g++ -o helloworld (this will create an executable file with the same name)
    ./helloworld (this should execute the helloworld)

  3. #3

    Member Since
    Apr 01, 2008
    The compiler wasn't installed. It's working fine now.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Month in Terminal is in Russian - only in Terminal!
    By yoandrew in forum macOS - Operating System
    Replies: 4
    Last Post: 12-29-2012, 09:20 AM
  2. Terminal Help?
    By gts1117 in forum macOS - Operating System
    Replies: 2
    Last Post: 08-20-2012, 09:25 AM
  3. Terminal Help
    By LMCLUMD in forum macOS - Development and Darwin
    Replies: 1
    Last Post: 06-15-2011, 04:08 AM
  4. help!! terminal os 10.5.8
    By alcohol in forum macOS - Operating System
    Replies: 10
    Last Post: 04-10-2011, 12:35 PM
  5. using terminal
    By mayflyTR in forum macOS - Operating System
    Replies: 3
    Last Post: 08-22-2010, 05:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts