New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus • Advice and insight from world-class Apple enthusiasts • Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Installing GCC


Post Reply New Thread Subscribe

 
Thread Tools
Jero

 
Member Since: Aug 04, 2007
Posts: 9
Jero is on a distinguished road

Jero is offline
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?
QUOTE Thanks
cradom

 
cradom's Avatar
 
Member Since: Feb 14, 2004
Location: Nederland, Texas
Posts: 3,473
cradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant futurecradom has a brilliant future
Mac Specs: 13in macbook - 10.10.1

cradom is offline
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.

Craig Domingue - resident redneck.
“Never argue with an idiot. He will only bring you down to his level and beat you with experience.”, George Carlin
QUOTE Thanks
Jero

 
Member Since: Aug 04, 2007
Posts: 9
Jero is on a distinguished road

Jero is offline
Thanks!
QUOTE Thanks
danielb
Guest
 
Posts: n/a

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.
QUOTE Thanks
DoubleCap

 
DoubleCap's Avatar
 
Member Since: Feb 12, 2007
Location: Northeast US
Posts: 552
DoubleCap will become famous soon enough
Mac Specs: MacBook 2GHz/2GB/CD

DoubleCap is offline
You do not need all of Xcode.
QUOTE Thanks
-Jonathan-

 
Member Since: Sep 18, 2007
Posts: 6
-Jonathan- is on a distinguished road

-Jonathan- is offline
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
QUOTE Thanks
danielb
Guest
 
Posts: n/a

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
QUOTE Thanks
-Jonathan-

 
Member Since: Sep 18, 2007
Posts: 6
-Jonathan- is on a distinguished road

-Jonathan- is offline
/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
QUOTE Thanks
-Jonathan-

 
Member Since: Sep 18, 2007
Posts: 6
-Jonathan- is on a distinguished road

-Jonathan- is offline
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?
QUOTE Thanks
xstep

 
xstep's Avatar
 
Member Since: Jun 25, 2005
Location: On the road
Posts: 3,231
xstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to allxstep is a name known to all
Mac Specs: 2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid

xstep is offline
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.
QUOTE Thanks
danielb
Guest
 
Posts: n/a

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.
QUOTE Thanks

Post Reply New Thread Subscribe


« XDarwin/X11 for Mac OSX | running apps from terminal »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Boot camp Xp, installing service pack 2 after windows? macymacmac Running Windows (or anything else) on your Mac 21 02-14-2008 01:21 PM
gcc compiling jdgti OS X - Development and Darwin 5 09-20-2006 05:08 AM
How to install GCC version 4.xx???? Philipina OS X - Development and Darwin 1 04-14-2006 11:25 AM
gcc compiler, no stdio.h found lzco OS X - Development and Darwin 6 10-21-2005 05:23 PM
GCC error the_jesus OS X - Development and Darwin 0 07-17-2004 08:04 PM

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

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

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?