Mac Forums

Mac Forums (http://www.mac-forums.com/forums/)
-   OS X - Operating System (http://www.mac-forums.com/forums/os-x-operating-system/)
-   -   Xcode Failed to Install G++ (http://www.mac-forums.com/forums/os-x-operating-system/269002-xcode-failed-install-g.html)

Shoal 03-08-2012 08:58 PM

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!

vansmith 03-08-2012 09:16 PM

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

Shoal 03-08-2012 09:20 PM

It says "udo" command not found.

vansmith 03-08-2012 09:22 PM

Oops, that was my inability to copy and paste. ;)

Commands fixed.

Shoal 03-08-2012 09:37 PM

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.

vansmith 03-08-2012 09:41 PM

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

Shoal 03-08-2012 09:43 PM

It returns:

Code:

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

vansmith 03-08-2012 10:21 PM

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/?

Shoal 03-09-2012 06:33 AM

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...)

vansmith 03-09-2012 11:23 AM

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).

Shoal 03-09-2012 07:03 PM

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?

vansmith 03-09-2012 08:21 PM

Yes, absolutely. Xcode 4.3 doesn't install the tools by default. Go to Xcode > Preferences > Downloads > Components > install "Command Line Tools."

Shoal 03-10-2012 09:20 PM

Works just fine now, thanks a lot for all your help! :)


All times are GMT -4. The time now is 09:32 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.