This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Why does linker fail to resolve dependencies within the same .a file?


Hi Christian,

/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++

Note: Placing "-luriVision" twice on the command line next to each other like that will not actually gain you anything. The only reason to include a library more than once on a linker command line is if it contains symbols that are referenced by files that are placed after the first occurrence of the library on the command line. eg:


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.

In function `uriVideoSources::ImageReader::getFrame(bool,
uriBase::RasterImage*)':
ImageReader.cpp:(.text+0x90): undefined reference to
`uriVideoSources::ImageReader_gen::getFrame_(bool,
uriBase::RasterImage*)'

cjc@peace:~$ nm --demangle
/home/cjc/csc583-svn/uriVisionLib/trunk/Development/Source/C++/liburiVision.a | grep outputFrame

As has already been pointed out you are greping for 'outputFrame' when the error message you have reported was for a missing 'getFrame_' symbol. I assume therefore that you are also getting error messages about a missing reference to 'outputFrame_' ?


0000002c T uriMovieEditing::ImageWriter::outputFrame(uriBase::RasterImage*)
00000000 T uriMovieEditing::ImageWriter::outputFrame(uriBase::RasterImage*,
bool)
U uriMovieEditing::ImageWriter_gen::outputFrame_(uriBase::RasterImage*,
bool)

Which if the above assumption is correct means that the linker is right. uriMovieEditing does contain an unresolved reference to an outputFrame_ symbol. You will need to add whichever library or object file contains that symbol to the linker command line, and if it is a library that contains it, then it must come *after* -luriVision on the command line.


Cheers
  Nick


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]