Undefined reference to static member
Nathan Sidwell
nathan@codesourcery.com
Tue Feb 4 20:22:00 GMT 2003
John Love-Jensen wrote:
> Hi Leo,
>
> It could be link order.
>
> g++ -o myapp foo.o bar.o
>
> If bar.o has dangling references that are satisfied in foo.o, they won't be
> pulled in because the (single pass!) link order is reversed.
you are confusing object files and archive files. The (traditional unix semantics
following) linker pulls in all the symbols of explicitly mentioned object files
and then searches any mentioned archive files on command line order to resolve
any further unresolved symbols. An object module pulled in from an archive file
can have its references resolved against other modules in the same archive and
later archives, but not earlier ones.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
The voices in my head said this was stupid too
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
More information about the Gcc-help
mailing list