Thread: Problems with GCC

  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    277

    Unhappy Problems with GCC

    I seem unable to compile anything with gcc, im using gcc-3.3.4-i486-1 under slackware linux 9.1

    Everytime I try to compile anything with gcc it reports the following errors:
    /usr/lib/gcc-lib/i486-slackware-linux/3.3.4/../../../../i486-slackware-linux/bin/ld: unrecognized option '--as-needed'
    /usr/lib/gcc-lib/i486-slackware-linux/3.3.4/../../../../i486-slackware-linux/bin/ld: use the --help option for usage information
    collect2: ld returned 1 exit status

    anyone has some idea avout how can I fix it?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Looks like a bad install to me, if you can't even compile a "hello.c"

    If you've just installed the latest compiler, perhaps you also need the latest linker.

    You could try
    gcc --verbose hello.c
    to see all the generated commands and command line options, to see where that rogue option comes from, though I'm not sure what you would do about it.
    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
    Comment your source code! Lynux-Penguin's Avatar
    Join Date
    Apr 2002
    Posts
    533
    it says your ld linker isn't working
    this could be because the linker's libraries are not where they're supposed to be or it compiled incorrectly. It's not gcc's fault exactly although ld, I believe, comes with the package.

    Try to recompile if the problem persists make sure you have the libraries *.so and the right includes in /usr/include
    Asking the right question is sometimes more important than knowing the answer.
    Please read the FAQ
    C Reference Card (A MUST!)
    Pointers and Memory
    The Essentials
    CString lib

  4. #4
    Registered User
    Join Date
    Jun 2004
    Posts
    277
    Quote Originally Posted by Lynux-Penguin
    it says your ld linker isn't working
    this could be because the linker's libraries are not where they're supposed to be or it compiled incorrectly. It's not gcc's fault exactly although ld, I believe, comes with the package.

    Try to recompile if the problem persists make sure you have the libraries *.so and the right includes in /usr/include
    You were right, my linker was obsolete towards the libs, so I've updated it with slackpkg and now everything is working fine thx a lot.

  5. #5
    Comment your source code! Lynux-Penguin's Avatar
    Join Date
    Apr 2002
    Posts
    533
    yeah no problem ^_^

    -LC
    Asking the right question is sometimes more important than knowing the answer.
    Please read the FAQ
    C Reference Card (A MUST!)
    Pointers and Memory
    The Essentials
    CString lib

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 02:59 AM
  2. gcc - linking to cwd
    By mike_g in forum Tech Board
    Replies: 3
    Last Post: 08-15-2008, 03:38 PM
  3. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  4. C Pointers Problems
    By mhelal in forum C Programming
    Replies: 8
    Last Post: 01-10-2007, 06:35 AM