[lug] Compilation Problem

Tom Tromey tromey at cygnus.com
Thu Jul 13 17:53:11 MDT 2000


Kevin> I get a bunch of errors about missing stuff from the tcp
Kevin> library.  If I reverse the libraries on the command line:

Kevin> g++ -o result -L ../../lib -llock -ltcp

Kevin> ...it compiles without any problems.  I didn't think the order
Kevin> of the libraries was significant -- why would it be so?
Kevin> (Caldera 2.2)

Unix linkers have always worked this way, and GNU ld is no exception.
Order matters.  Each library is searched once, in the order in which
it appears on the command line.  If you have mutually dependent
libraries then you have to list them twice (or use a group).

This is probably explained in the linker manual.

Tom




More information about the LUG mailing list