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]

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


I'm using CMake to build a library (as a .a file) and a demo program
for that library.


My problem is that when I go to link that demo program, I get a linker error that says one file function in the .a file can't find another function in the .a file. Here's what the linker command line and error output look like:


Linking CXX executable simpleIO cd /home/cjc/csc583-svn/uriVisionLib/trunk/SDK/Demos/C++/Basic/Simple_IO && /home/cjc/packages/CMake/bin/cmake -P CMakeFiles/simpleIO.dir/cmake_clean_target.cmake cd /home/cjc/csc583-svn/uriVisionLib/trunk/SDK/Demos/C++/Basic/Simple_IO && /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++ /home/cjc/csc583-svn/uriVisionLib/trunk/Development/Source/C++/liburiVision.a(ImageReader.o): In function `uriVideoSources::ImageReader::getFrame(bool, uriBase::RasterImage*)': ImageReader.cpp:(.text+0x90): undefined reference to `uriVideoSources::ImageReader_gen::getFrame_(bool, uriBase::RasterImage*)'


(there are more errors as well, but I figured this was enough to make my point).


I thought that perhaps the supposedly missing function wasn't in the
.a file, so I check with nm as follows:


cjc@peace:~$ nm --demangle /home/cjc/csc583-svn/uriVisionLib/trunk/Development/Source/C++/liburiVision.a | grep outputFrame 0000002c T uriMovieEditing::ImageWriter::outputFrame(uriBase::RasterImage*) 00000000 T uriMovieEditing::ImageWriter::outputFrame(uriBase::RasterImage*, bool) U uriMovieEditing::ImageWriter_gen::outputFrame_(uriBase::RasterImage*, bool)



So it appears to be in there.  I also thought that maybe this was one
of the cases where I needed to list the .a file twice on the linker
command line, but the linker invocation / output shown above already
reflects my doing that (I think).


Does anyone know where I might be going wrong here?


Thanks,
Christian


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