Installing GCC

Joined
Aug 4, 2007
Messages
9
Reaction score
0
Points
1
I'm trying to get the GCC compiler installed on my Mac. I installed the gcc4.0 package on the Mac OS X Install Disc, which is in the Xcode Tools directory. However, even after installing, Terminal says it doesn't understand the gcc command…

What did I do wrong?
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
You need to install all of Xcode, not just the gcc package. There are libraries and headers that gcc needs.
If you're trying to save space, you can choose not to install the docs.
 
D

danielb

Guest
You should not need to install the complete xcode package. It may be a PATH problem and the shell cannot find gcc anywhere it is looking. Make sure you PATH includes the bin directory containing gcc. From the terminal, type "which gcc". If it says it is not found, it is the PATH.
 
Joined
Feb 12, 2007
Messages
552
Reaction score
8
Points
18
Location
Northeast US
Your Mac's Specs
MacBook 2GHz/2GB/CD
You do not need all of Xcode.
 
Joined
Sep 18, 2007
Messages
6
Reaction score
0
Points
1
I actually still some problem installing GCC

I installed the gcc 4.0 and 3.3 for good measure, yet i still fail to run it

I do know probably its the path problem

jonathanong:~ Jonathan$ which gcc
no gcc in /opt/local/bin /opt/local/sbin /bin /sbin /usr/bin /usr/sbin

And i've got problem installing darwin port because it says gcc not installed. Lets say my .c file or a header .h file is in the desktop, how do i actually compile it or find the path to link it to?

Usually its just gcc <filename> or if i'm trying to compile a openGL file

cc main-good.c -o simple -framework GLUT -framework OpenGL -lobjc

but it still says -bash: cc: command not found

An advice will tremendously help me
 
D

danielb

Guest
Try which gcc-4.0 and see if it finds that. On my machine, all the gcc's are in /usr/bin. From your post, you have that in the path so if they are installed there it should be good.

Here is how I did it. I wanted to use gcc filename to compile, so I made a link called gcc to gcc-4.0. If I want to use 3.0 I just change the link. Also, cc is just a link to gcc-4.0.

lrwxr-xr-x 1 root wheel 7 Jul 11 21:58 gcc -> gcc-4.0
-r-xr-xr-x 1 root wheel 260616 Sep 11 2006 gcc-3.3
-rwxr-xr-x 1 root wheel 80168 Sep 27 2006 gcc-4.0
 
Joined
Sep 18, 2007
Messages
6
Reaction score
0
Points
1
/usr/bin/gcc-4.0

Yup, which gcc-4.0 found that

How do i make a link to gcc or cc? If that one you were showing was it, than it doesn't work
 
Joined
Sep 18, 2007
Messages
6
Reaction score
0
Points
1
I tried compiling, and they have problem detecting the libraries stdio.h and stdlib.h

those common ones, not even openGLs

Do i really have to install the whole XCode tool?
 
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 really don't understand why you wouldn't install the XCode tools. If nothing else, it saves you the hassle you are going through now. You could always remove the parts you do not want or need.
 
D

danielb

Guest
gcc should look for header files in /usr/include and libraries in /usr/lib

I would look in these locations and verify the files exist. If they do exist, it may be a gcc configuration issue. I would have expected the files to be included with the installation of gcc.

To find out about a link "man ln" or search the web.
 

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