Mac Forums

Mac Forums (
-   OS X - Development and Darwin (
-   -   gcc command not found (

frike 10-14-2008 04:23 AM

gcc command not found

when I try to use the gcc command in terminal I get a message saying "-bash: gcc: command not found"

I have installed Xcode 2.5 and I'm on Leopard.

I've searched the forums for an answer, but I'm really new to this, so I don't know what to do if the PATH is wrong or something like that.

I'd appreciate any help!

xstep 10-15-2008 12:14 AM

Log out and back in, and then in terminal type "whereis gcc" minus the quotes.

frike 10-15-2008 07:32 AM

It couldn't find it before, but now I copied the contents of /Xcode2.5/usr/bin into usr/bin and now it can find it.
It still doesn't work though, when I'm trying to compile something (we have to use Eclipse at Uni) I get an error message saying:

make all
Building file: ../src/TestHelloWorld.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/TestHelloWorld.d" -MT"src/TestHelloWorld.d" -o"src/TestHelloWorld.o" "../src/TestHelloWorld.cpp"
../src/TestHelloWorld.cpp:9:20: error: iostream: No such file or directory
../src/TestHelloWorld.cpp: In function 'int main()':
../src/TestHelloWorld.cpp:13: error: 'cout' was not declared in this scope
../src/TestHelloWorld.cpp:13: error: 'endl' was not declared in this scope
make: *** [src/TestHelloWorld.o] Error 1

which makes me think that just copying the bin contents was not really a solution to my problem.
How can I set it so Eclipse (and the terminal) can find something that lies in /Xcode2.5?

xstep 10-16-2008 12:46 AM

Copying the content over isn't the right answer.

It look like the path is not being added in for XCode. Since you didn't report what 'whereis' gave you, we don't know at that level.

frike 10-16-2008 09:25 AM

well, whereis gcc now gives me /usr/bin/gcc as an answer, since I copied the content.
Before that it was in /Xcode2.5/usr/bin but whereis gcc didn't give me any answer at all.

Anyway, I've included all the includes and libraries paths into Eclipse now, but now there's one error remaining:

/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: /usr/lib/system/libmathCommon.A.dylib load command 6 unknown cmd field

Isn't there some way to get all the directories in /Xcode2.5 included into the proper paths in Eclipse? And into the proper paths for the terminal, since I don't want to always include them manually whenever I'm trying to compile something.

Still, thanks for taking the time to help :)

xstep 10-16-2008 11:20 AM

I don't know Eclipse so can't answer that. In terminal you'll have a login script for the shell you are running. I believe that would be the .profile file. Do a 'man bash' at the terminal prompt.

Dysfunction 10-19-2008 04:12 PM

in bash .profile would be the one I'd use, well and do use

My path statement in .profile looks like such...


export PATH=/Users/mike/scripts:$PATH:/opt/ibm/dscli

daqi 05-16-2011 10:50 AM

Hi, guys,

Could you tell me how did you solve the problem below?

/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: /usr/lib/system/libmathCommon.A.dylib load command 6 unknown cmd field

Thanks a lot!


All times are GMT -4. The time now is 01:46 AM.

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