gcc command not found

Joined
Apr 1, 2008
Messages
9
Reaction score
0
Points
1
Hello,

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!
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
Log out and back in, and then in terminal type "whereis gcc" minus the quotes.
 
OP
F
Joined
Apr 1, 2008
Messages
9
Reaction score
0
Points
1
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?
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
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.
 
OP
F
Joined
Apr 1, 2008
Messages
9
Reaction score
0
Points
1
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 :)
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
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.
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
in bash .profile would be the one I'd use, well and do use

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

Code:
#paths
export PATH=/Users/mike/scripts:$PATH:/opt/ibm/dscli
 
Joined
May 13, 2011
Messages
3
Reaction score
0
Points
1
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!

Daqi
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top