The project I'm working with, uses the VTK (ver 5.8.0), c++ 4.6.3, buntu 12.04
The code compiles w/o any errors. The linker is failing with: undefined reference to QVTKWidget2::QVTKWidget2(QWidget*, QGLWidget const*, QFlags)
This class is in VTK/GUISupport/Qt/QVTKWidget2.cxx
As far as I can tell, this is in libQVTK.a (grep -i -l QVTKWidget2 *.a
) or libQVTK.so, libQVTKWidgetPlugin.so (grep -i -l QVTKWidget2 *.so
) But I'm not sure a text search is enough to say the reference/symbol is there. I'm not sure what the linker is looking for.
When I try to locate the symbol w/ nm -A *.a|grep QVTKWidget2
the five responses are too cryptic for me to understand. (I'm not sure what to look for.)
When I look at the .so files (ldd libQVTK.so
), I see references to different libs, and no mention of QVTKWidget2. (Further confusion.)
The linker cmd is /usr/bin/c++
The library is called explicitly with /full/path/to/VTK/build/bin/libQVTK.a
Edit 1:
In this case a simple text search is not good enough. grep -i -l QVTKWidget2 *.a
will flag libQVTK.a When taking a closer look at the archive ar -t libQVTKA.a
, this lib contains QVTKWidget.cxx.o There is no mention of QVTKWidget2.cxx.o. I'll guess this is due to name mangling, or just the archive format.
Edit 2:
nm -C libQVTK.a | grep QVTKWidget2
returns nothing. nm -C libQVTK.a |grep QVTKWidget
shows there is only QVTKWidget class members in this archive. nm -C libQVTK.so | grep QVTKWidget2
, again returns nothing, while nm -C libQVTK.so | grep QVTKWidget
shows only QVTKWidget class members. The results are the same for libQVTKWidgetPlugin.so Again, due to name mangling, a text search is misleading.
Is there a quick way to find out which library has the QVTKWidget2 class? (QVTKWidget2.cxx.o)