Results 1 to 13 of 13

Thread: Xcode Failed to Install G++

  1. #1


    Member Since
    Jan 19, 2012
    Posts
    14
    Question Xcode Failed to Install G++
    Hi all.

    Just days ago I installed Xcode from the App Store, but then when I went to the terminal prompt I discovered that the g++ command wasn't there. What gives? Everyone tells me it's supposed to be there, and I need it...

    Any help would be greatly appreciated. Thanks!

  2. #2

    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,853
    It should be there but you wouldn't be the first person missing the links. Execute the following commands to set the links:
    Code:
    sudo ln -s /Developer/usr/bin/llvm-g++-4.2 /usr/bin/g++
    Code:
    sudo ln -s /Developer/usr/bin/llvm-gcc-4.2 /usr/bin/gcc
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  3. #3


    Member Since
    Jan 19, 2012
    Posts
    14
    It says "udo" command not found.

  4. #4

    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,853
    Oops, that was my inability to copy and paste.

    Commands fixed.
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  5. #5


    Member Since
    Jan 19, 2012
    Posts
    14
    The line to enter g++ didn't seem to work. It gave me a very grave warning that I was probably about the screw up my machine and then asked me for my password. I entered it, pressed enter, and was unceremoniously returned to the prompt with no sign of success or failure. Entering in the line again says, "Line exists." But here's the thing: it still tells me no g++ command exists.

  6. #6

    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,853
    When it completes, you don't get a warning or success message. In fact, having nothing printed back is a good sign.

    What does the following return?
    Code:
    echo $PATH
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  7. #7


    Member Since
    Jan 19, 2012
    Posts
    14
    It returns:

    Code:
    /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

  8. #8

    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,853
    Well, /usr/bin is in your PATH (as it should be) and there is a symlink there called "g++" to the g++ binary installed by Xcode. Do you at least have success executing llvm-g++-4.2 from /Developer/usr/bin/?
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  9. #9


    Member Since
    Jan 19, 2012
    Posts
    14
    Is "llvm-g++-4.2" a command that needs to be run from a specific directory? (You're dealing with a guy who has lots of DOS experience but virtually zero Unix command line experience. I have to look up how to change directories...)

  10. #10

    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,853
    cd = change directory.

    You can simply execute /Developer/usr/bin/llvm-g++-4.2 or "cd" into /Developer/usr/bin and then type "./llvm-g++-4.2" (without the quotes).
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  11. #11


    Member Since
    Jan 19, 2012
    Posts
    14
    It says "no such file or directory" when I enter "/Developer/usr/bin/llvm-g++-4.2".

    Would it make any difference to say I have Xcode 4.3?

  12. #12

    vansmith's Avatar
    Member Since
    Oct 19, 2008
    Location
    Toronto
    Posts
    19,853
    Yes, absolutely. Xcode 4.3 doesn't install the tools by default. Go to Xcode > Preferences > Downloads > Components > install "Command Line Tools."
    Important Links: Community Guidelines : Use the reputation system if you've been helped.
    M-F Blog :: Write for the blog
    Writing a Quality Post

  13. #13


    Member Since
    Jan 19, 2012
    Posts
    14
    Works just fine now, thanks a lot for all your help!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. OS X 10.9.2 failed to install
    By Alwyn in forum macOS - Operating System
    Replies: 1
    Last Post: 03-01-2014, 03:11 PM
  2. xcode error: clang++ failed with exit code 1
    By wfs123 in forum iOS Development
    Replies: 5
    Last Post: 02-22-2012, 04:23 PM
  3. Install Failed
    By DMLambert in forum macOS - Apps and Games
    Replies: 5
    Last Post: 05-22-2011, 02:52 AM
  4. Xcode: "Command /Developer/usr/bin/g++-4.0 failed with exit code 1" HELP
    By finnm in forum macOS - Development and Darwin
    Replies: 1
    Last Post: 10-15-2008, 10:57 AM
  5. Need help; Xcode Build Failed Compiling controlTunes
    By kayoszero in forum macOS - Development and Darwin
    Replies: 0
    Last Post: 06-15-2008, 03:16 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
  •