foo.o -lbar baz.o -lbar
The second "-lbar" is only needed if baz.o includes references to
symbols that are defined in libbar.a which will not be pulled in when
resolving the references made by foo.o.
I'm not so sure that's true, because someone said that putting "bar.a"
on the linker command line is pretty much identical in effect to
listing, on the command line, the files that got bundled up into
bar.a. So if bar.a is made up of x.o, y.o and z.o, and z.o contains a
function that depends on a function in x.o, then I really do need to
list bar.a twice in order to resolve that dependency. No?
I pasted an irrelevant example by accident, but I really am seeing the
problem in question (I think). Here's the link command and my first
error message from it:
/usr/bin/c++ -fPIC "CMakeFiles/simpleIO.dir/main_IO.o" -o
simpleIO -rdynamic
-L/home/cjc/csc583-svn/uriVisionLib/trunk/Development/Source/C++ -lGL
-lglut -Wl,-Bstatic -luriVision -luriVision -Wl,-Bdynamic
-Wl,-rpath,/home/cjc/csc583-svn/uriVisionLib/trunk/Development/Source/C++