link problems on mac

Discussion in 'Mac Programming' started by glennie, Oct 11, 2007.

  1. glennie macrumors newbie

    Joined:
    Oct 11, 2007
    #1
    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.
     
  2. sord macrumors 6502

    Joined:
    Jun 16, 2004
    #2
    Not sure how you have gcc without XCode...please post the command you are trying to use to compile.
     
  3. Eraserhead macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #3
    Can you type gcc -v into terminal and post the result.

    Also what version of Mac OS X are you running?
     
  4. willyme macrumors newbie

    Joined:
    Oct 11, 2007
    #4
    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.
     
  5. glennie thread starter macrumors newbie

    Joined:
    Oct 11, 2007
    #5
    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 :)
     
  6. Sayer macrumors 6502a

    Sayer

    Joined:
    Jan 4, 2002
    Location:
    Austin, TX
    #6
  7. Eraserhead macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #7
    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.
     

Share This Page