Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

glennie

macrumors newbie
Original poster
Oct 11, 2007
2
0
I'm trying to compile a c++ project on my new mac uing the MacOSX GCC compiler, but I get the following error message:

usr/bin/ld: warning -L: directory name (lib) does not exist
/usr/bin/ld: can't locate file for: -lcrt0.o
collect2: ld returned 1 exit status

From what I can gather by google'ing the error, it's caused by the GCC compiler. Does anyone have a solution? I don't normally program C/C++ (but Java) so I'm not really interested in installing xcode.
 
Not sure how you have gcc without XCode...please post the command you are trying to use to compile.
 
Can you type gcc -v into terminal and post the result.

Also what version of Mac OS X are you running?
 
Install xcode

Installing the developer tools gives you more then just xcode. You also get the BSD subsystem that is required when using GCC. You get all the libraries, headers, documentation... all the stuff you need to compile c++.

Install the tools and your problems will go away.
 
I'm running MAC OS X 10.4.10.

when I type gcc -v I get the following output:

Using built-in specs.
Target: i686-apple-darwin8
Configured with: /private/var/tmp/gcc/gcc-5367.obj~1/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=powerpc-apple-darwin8 --with-arch=nocona --with-tune=generic --program-prefix= --host=i686-apple-darwin8 --target=i686-apple-darwin8
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5367)

I understand that xcode is a preference to many, but I'm a Java-developer with no plans to go back to developing in C/C++. I simply need to compile this one project and then I'll be happy :)
 
I understand that xcode is a preference to many, but I'm a Java-developer with no plans to go back to developing in C/C++. I simply need to compile this one project and then I'll be happy :)

You still need to install Xcode to use the developers tools at all, so download Xcode from developer.apple.com (you'll need a free developers account to do this), and then uncheck everything except gcc 4.0 from the installation list and it should be OK.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.