Results 1 to 3 of 3
  1. #1

    Member Since
    Mar 30, 2012
    Problem running g++ from terminal window
    I have this infuriating problem; I'm trying to compile a simple example from Stroustrup's book on C++:

    g++ char.gpp -o char

    I get the following error:

    ld: library not found for -lcrt1.10.6.o
    collect2: ld returned 1 exit status

    So, I found where crt1.10.6.o is, and set LIBRARY_PATH to:


    and then the compile step gives:

    ld: warning: in char.gpp, file was built for unsupported file format which is not the architecture being linked (x86_64)
    Undefined symbols:
    "_main", referenced from:
    start in crt1.10.6.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status

    This is in Lion with the latest Xcode newly installed. The library crt1.10.6.o seems to be the issue.

    Failing that, is there a way to run the Xcode to generate a command-line executable?

  2. #2

    Mark FX's Avatar
    Member Since
    Aug 13, 2011
    West Sussex, UK
    I'm running Xcode 4.2, and there is a command line tool project template in the Mac OSX applications category, when starting a new project from the file menu.
    But I dont know if this template is still available in the latest 4.3 version of Xcode, I would find it hard to
    believe, they have ditched this template in the latest release of Xcode.

    So if the command line tool project template is still available, then thats what I would, and have used previously.

    Sorry I could not be more help.

    Regards Mark

  3. #3

    Member Since
    Mar 30, 2012
    I've figured out one thing: the file should probably have ".cc" rather than ".gpp" as the suffix. I guess .gpp refers to a preprocessed file.

    So then the problem becomes: error: iostream: No such file or directory

    Header files are in the /Developer/SDKs/.... but I would expect the compiler to know where to find these files.

    So I'm not quite there. I'd appreciate any help; I'd really like to compile files from the terminal while practicing C++ coding.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Problem running terminal
    By choergel in forum macOS - Operating System
    Replies: 2
    Last Post: 05-26-2011, 06:30 PM
  2. moving around in terminal window
    By kkempter in forum macOS - Operating System
    Replies: 0
    Last Post: 04-16-2008, 02:41 PM
  3. The Terminal Window
    By boletje in forum macOS - Operating System
    Replies: 9
    Last Post: 02-20-2007, 05:52 PM
  4. terminal window on desktop?
    By colonel_forbin in forum Images, Graphic Design, and Digital Photography
    Replies: 2
    Last Post: 06-03-2004, 01:53 PM
  5. terminal window
    By sexton in forum Running Windows (or anything else) on your Mac
    Replies: 3
    Last Post: 10-22-2003, 12:40 AM

Posting Permissions

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