Undefined symbols from ld? ; making bundle; gcc 3.3

This is a discussion on Undefined symbols from ld? ; making bundle; gcc 3.3 within the C Programming forums, part of the General Programming Boards category; I have been pulling my hair out trying to figure out this error when using ld Code: > gcc -fPIC ...

  1. #1
    Registered User profxtjb's Avatar
    Join Date
    May 2004
    Posts
    8

    Question Undefined symbols from ld? ; making bundle; gcc 3.3

    I have been pulling my hair out trying to figure out this error when using ld
    Code:
    > gcc -fPIC -c edges.c
    > gcc -fPIC -c bfunctions.c
    
    > ld -bundle -t -o edges.so edges.o bfunctions.o
    
    ld: Pass 1
    edges.o 
    bfunctions.o 
    ld: Undefined symbols:
    ___sF
    _atof
    _fclose
    _fopen
    _fprintf
    _memcpy
    _perror
    _printf
    _strcat
    dyld_stub_binding_helper
    I have got all the right #include files in edges.c so those undefined symbols are looking mysterious.

    I have done this process before, making a Mach-0 "bundle" but today it is coming up with these errors. Is there somewhere I should look -- source files? gcc options? -- to resolve this headache? Has it got to do with using more than one object file?

    Gracias for the help.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,533
    Use gcc to call ld
    It passes along a whole bunch of stuff (use -v to find out what)

    I didn't find a -bundle in the help for ld - what exactly are you trying to do?
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User profxtjb's Avatar
    Join Date
    May 2004
    Posts
    8

    Post

    Quote Originally Posted by Salem
    Use gcc to call ld
    It passes along a whole bunch of stuff (use -v to find out what)

    I didn't find a -bundle in the help for ld - what exactly are you trying to do?
    -bundle is the Mac OS-X flag to gcc that creates a shared library. It corresponds to /DLL on a Windows box and -shared on Linux.

  4. #4
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926
    does this help you
    Code:
    gcc -o (name of program)  *.o

  5. #5
    Registered User profxtjb's Avatar
    Join Date
    May 2004
    Posts
    8
    Quote Originally Posted by linuxdude
    does this help you
    Code:
    gcc -o (name of program)  *.o
    I already know how to do that.

  6. #6
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Try adding these flags then to your compile lines: "-Wall" and "-pedantic". Then remove your object files and recompile.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  2. C OpenGL Compiler Error?
    By Matt3000 in forum C Programming
    Replies: 12
    Last Post: 07-07-2006, 04:42 PM
  3. DLL Making and Symbols - 2 Queries
    By Tronic in forum C++ Programming
    Replies: 9
    Last Post: 12-31-2004, 12:11 AM
  4. GCC bool undefined
    By Stack Overflow in forum Linux Programming
    Replies: 3
    Last Post: 07-06-2004, 12:54 PM
  5. qt help
    By Unregistered in forum Linux Programming
    Replies: 1
    Last Post: 04-20-2002, 09:51 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21