Re: unresolved symbol with shared library

From: Oliver Otto (O.Otto_at_reading.ac.uk)
Date: 10/13/03


Date: Mon, 13 Oct 2003 13:13:54 +0100

Sorry about posting this here and thanks for your help.

Rolf Magnus wrote:

>Note that your problem is off-topic here. This newsgroup is only about
>the C++ programming language as defined by the ISO, not about problems
>with specific compilers/linkers.
>
>Oliver wrote:
>
>
>
>>Hi,
>>
>>I have a problem with a shared library of mine. I compile the *.o
>>files and then generate the .so lib with:
>>cc -shared libjava_vrpn.so *.o
>>When I then run my program I get an error for an unresolved symbol.
>>
>>The symbols it's looking for are in another library called libvrpn.a,
>>but for some unknown reason the compiler does not uses this library
>>when I tell him to used.
>>I compile the libs as before and then try:
>>cc -shared -L../sgi_irix.../ -lvrpn -o libjava_vrpn.so *.o
>>The compiler then comes with a waring that the libvrpn.a is not used
>>for resolving any symbol and my application is still complaining about
>>the first unresolved symbol.
>>
>>When use the command nm to check the library's I can see that the
>>sybol could be resolved by using the libvrpn.a. What do I do wrong?
>>
>>
>
>What happens is that the linker goes through the files you provided in
>the order you specified. It maintains a list of unresolved symbols
>internally. When it comes to -lvrpn, it sees that this archive cannot
>be used to resolve any symbols (since there are no unresolved symbols
>yet), throws it away and goes on. Later, your object files come and
>need some external symbols (from that archive), which now are added to
>the list of unresolved symbols. Those are never resolved, since there
>is nothing after the .o files, so you get a linking error. Try
>providing the archive _after_ the .o files.
>
>
>



Relevant Pages

  • Re: Getting rid of libstdc++?
    ... >> Did it result in unresolved symbols? ... > better when you can't even rely on linked files. ... version of compiler they were compiled with. ... In order to understand recursion you must first understand recursion. ...
    (comp.unix.programmer)
  • Re: [SLE] help with gcc3.3.1 update and kernel compiling
    ... > overwritten by the buggy new compiler code, in case one tries to recompile ... and no overwrite is possible anyway. ... More likely, the kernel itself. ... and found there were "Unresolved symbols" on the kernel ...
    (SuSE)
  • Re: Command line processing
    ... My compiler says those two are unresolved symbols. ... Microsoft compiler (Visual studio). ...
    (microsoft.public.win32.programmer.kernel)
  • Re: unresolved symbol with shared library
    ... the C++ programming language as defined by the ISO, ... > I compile the libs as before and then try: ... > for resolving any symbol and my application is still complaining about ... It maintains a list of unresolved symbols ...
    (comp.lang.cpp)
  • Re: Using static library
    ... resolving the references to the xerces? ... unresolved symbols, they simply stay unresolved until the final linking ... In fact I think the no resolving at all is done. ...
    (microsoft.public.vc.language)