Thread: Compile Error

  1. #1
    Registered User
    Join Date
    Nov 2011
    Location
    Buea, Cameroon
    Posts
    197

    Compile Error

    I don't know how to resolve this.

    Code:
    [localhost@localhost Code]$ gcc -static -O2  -o  out c.c
    /usr/bin/ld: cannot find -lc
    collect2: error: ld returned 1 exit status
    [localhost@localhost Code]$

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Well the first thing to try is
    gcc -v -static -O2 -o out c.c

    This will show you all the command line options to all the compiler stages.
    In particular, you need to look at all the -L/path/to/here options passed to collect2

    Do all your compilations fail? or only those where the input file is called c.c?, or where you're passing -static as an option?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Nov 2011
    Location
    Buea, Cameroon
    Posts
    197
    It's only when I use the static option.

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    And what about following Salem's other suggestions?
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 15
    Last Post: 11-28-2011, 11:48 AM
  2. compile time error or runtime error?
    By George2 in forum C# Programming
    Replies: 3
    Last Post: 05-07-2008, 07:08 AM
  3. Compile error... Resource error to :/.
    By Blackroot in forum Windows Programming
    Replies: 3
    Last Post: 08-23-2006, 05:09 PM
  4. 0 compile error but 2 build error. need help please!
    By jibbles in forum C Programming
    Replies: 5
    Last Post: 08-30-2004, 04:30 PM
  5. compile once, compile twice ...error
    By Benzakhar in forum Windows Programming
    Replies: 6
    Last Post: 12-28-2003, 06:00 AM