static library and undefined reference

Eljay Love-Jensen
Fri Apr 9 13:17:00 GMT 2004

Hi Iker,

The order of the libraries on the command line is significant.

If library libfoo.a has an undefined symbol, and that symbol is in 
libbar.a, you need to put libfoo.a before libbar.a on the command line.

If you have a situation where libfoo.a is dependent on libbar.a, and 
libbar.a is dependent on libfoo.a, you'll need to specify them 
twice:  libfoo.a libbar.a libfoo.a.  Generally, it's recommended that you 
don't have interdependencies like that.


More information about the Gcc-help mailing list