[vtkusers] Fwd: undefined reference problem while linking

Shailender Kanwar shailender.kanwar at gmail.com
Wed Dec 10 01:06:10 EST 2008


hi all

i am a newbie to vtk. I am using vtk 5.2.
while compiling a QT application using vtk, i keep on getting
undefined reference error for vtk classes and methods

in my program iam trying only to create a QVTKWidget object
but i am facing a load of undefined references

i have recompiled vtk many times tweaking the build settings in cmake
but to no avail
i even tried using vtk 5.0.4 but the same problem comes there too
i have tried on both windows and linux but the problem doesnt go away

here is a part of the error message

g++ -Wl,-rpath,/usr/local/Trolltech/Qt-4.4.3/lib -o test main.o
-L/usr/local/Trolltech/Qt-4.4.3/lib -L/usr/local/lib/vtk-5.2 -lQVTK
-lvtkCommon -lQtGui -L/usr/local/Trolltech/Qt-4.4.3/lib
-L/usr/X11R6/lib -pthread -lpng -lSM -lICE -pthread -pthread -lXi
-lXrender -lXrandr -lfreetype -lfontconfig -lXext -lX11 -lQtCore -lz
-lm -pthread -lgthread-2.0 -lglib-2.0 -lrt -ldl -lpthread
/usr/local/lib/vtk-5.2/libQVTK.a(QVTKWidget.o)(.text+0x19): In
function `QVTKWidget::GetRenderWindow()':
: undefined reference to `vtkRenderWindow::New()'
/usr/local/lib/vtk-5.2/libQVTK.a(QVTKWidget.o)(.text+0xfe): In
function `QVTKWidget::saveImageToCache()':
: undefined reference to `vtkImageData::SetNumberOfScalarComponents(int)'
/usr/local/lib/vtk-5.2/libQVTK.a(QVTKWidget.o)(.text+0x132): In
function `QVTKWidget::saveImageToCache()':
: undefined reference to `vtkDataSetAttributes::GetScalars()'
/usr/local/lib/vtk-5.2/libQVTK.a(QVTKWidget.o)(.text+0x1c4): In
function `QVTKWidget::setAutomaticImageCacheEnabled(bool)':
: undefined reference to `vtkImageData::SetScalarType(int)'
/usr/local/lib/vtk-5.2/libQVTK.a(QVTKWidget.o)(.text+0x5b2): In
function `QVTKWidget::paintEvent(QPaintEvent*)':
: undefined reference to `vtkDataSetAttributes::GetScalars()'
/usr/local/lib/vtk-5.2/libQVTK.a(QVTKWidget.o)(.text+0x11fc): In
function `QVTKInteractor::TimerEvent(int)':
: undefined reference to `vtkRenderWindowInteractor::IsOneShotTimer(int)'
/usr/local/lib/vtk-5.2/libQVTK.a(QVTKWidget.o)(.text+0x120f): In
function `QVTKInteractor::TimerEvent(int)':
: undefined reference to `vtkRenderWindowInteractor::DestroyTimer(int)'
/usr/local/lib/vtk-5.2/libQVTK.a(QVTKWidget.o)(.text+0x1239): In
function `QVTKInteractor::~QVTKInteractor()':
: undefined reference to
`vtkRenderWindowInteractor::~vtkRenderWindowInteractor()'
/usr/local/lib/vtk-5.2/libQVTK.a(QVTKWidget.o)(.text+0x1281): In
function `QVTKInteractor::~QVTKInteractor()':
: undefined reference to
`vtkRenderWindowInteractor::~vtkRenderWindowInteractor()'
/usr/local/lib/vtk-5.2/libQVTK.a(QVTKWidget.o)(.text+0x12c9): In
function `QVTKInteractor::~QVTKInteractor()':
: undefined reference to
`vtkRenderWindowInteractor::~vtkRenderWindowInteractor()'
/usr/local/lib/vtk-5.2/libQVTK.a(QVTKWidget.o)(.text+0x2044): In
function `QVTKWidget::QVTKWidget(QWidget*, QFlags<Qt::WindowType>)':
: undefined reference to `vtkImageData::New()'
/usr/local/lib/vtk-5.2/libQVTK.a(QVTKWidget.o)(.text+0x2052): In
function `QVTKWidget::QVTKWidget(QWidget*, QFlags<Qt::WindowType>)':
: undefined reference to `vtkImageData::SetScalarType(int)'
/usr/local/lib/vtk-5.2/libQVTK.a(QVTKWidget.o)(.text+0x2144): In
function `QVTKWidget::QVTKWidget(QWidget*, QFlags<Qt::WindowType>)':
: undefined reference to `vtkImageData::New()'
/usr/local/lib/vtk-5.2/libQVTK.a(QVTKWidget.o)(.text+0x2152): In
function `QVTKWidget::QVTKWidget(QWidget*, QFlags<Qt::WindowType>)':
: undefined reference to `vtkImageData::SetScalarType(int)'
/usr/local/lib/vtk-5.2/libQVTK.a(QVTKWidget.o)(.text+0x2272): In
function `QVTKInteractor::QVTKInteractor()':
: undefined reference to
`vtkRenderWindowInteractor::vtkRenderWindowInteractor()'
/usr/local/lib/vtk-5.2/libQVTK.a(QVTKWidget.o)(.text+0x2329): In
function `QVTKInteractor::QVTKInteractor()':
: undefined reference to
`vtkRenderWindowInteractor::~vtkRenderWindowInteractor()'
/usr/local/lib/vtk-5.2/libQVTK.a(QVTKWidget.o)(.text+0x256b): In
function `QVTKWidget::SetRenderWindow(vtkRenderWindow*)':
: undefined reference to
`vtkRenderWindow::SetInteractor(vtkRenderWindowInteractor*)'
/usr/local/lib/vtk-5.2/libQVTK.a(QVTKWidget.o)(.text+0x257f): In
function `QVTKWidget::SetRenderWindow(vtkRenderWindow*)':
: undefined reference to `vtkInteractorStyleTrackballCamera::New()'
/usr/local/lib/vtk-5.2/libQVTK.a(QVTKWidget.o)(.text+0x282e): In
function `QVTKInteractor::QVTKInteractor()':
: undefined reference to
`vtkRenderWindowInteractor::vtkRenderWindowInteractor()'


please help me i have seen some people on the mailing list having
similar problem
but no solutions
i have been stuck at this problem for the last 4 weeks

i have tried everything i could think of, am i missing some linking
option or something similar


thanks

shailender kanwar



More information about the vtkusers mailing list