[vtkusers] VTK with QT, linking problem with uic ?

Antonin Perrot-Audet antonin07130 at gmail.com
Thu Apr 29 18:17:57 EDT 2010


Hello,

I am trying to use the QVTKWidget, within a CMake project. I get an 
undefined symbol error :

Undefined symbols:
"QVTKWidget::QVTKWidget(QWidget*, QFlags<Qt::WindowType>)", referenced from:
Ui_Form::setupUi(QWidget*) in form.cxx.o
ld: symbol(s) not found

I tried to include as much libraries as possible in my cmakelists.txt : 
here is a short version of it :

   PROJECT(ITKVTKQT)
   INCLUDE( ${QT_USE_FILE} )
   # this will run uic on .ui files:
   QT4_WRAP_UI( ITKVTKQT_UI_HDRS ${ITKVTKQT_UIS} )
   # and finally this will run moc:
   QT4_WRAP_CPP( ITKVTKQT_MOC_SRCS ${ITKVTKQT_MOC_HDRS} )
   # we need this to be able to include headers produced by uic in our code
   INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR} )

   # We finally build and link all together :
   ADD_EXECUTABLE(ItkVtkQt ${ITKVTKQT_SRCS} ${ITKVTKQT_MOC_SRCS} 
${ITKVTKQT_RC_SRCS} ${ITKVTKQT_UI_HDRS})
   TARGET_LINK_LIBRARIES(ItkVtkQt ${VTK_LIBRARIES} ${ITK_LIBRARIES} 
${QT_LIBRARIES})

It seems like the problem comes from the ui conversion (uic), it doesn't 
find the QVTKWidget symbol I guess, but I don't understand why, as the 
header generated by uic contains #include <QVTKWidget.h> ...

Does anyone have an idea ? Any help would be greatly appreciated.

Thanks,

Antonin


PS : thanks for the Compile error on OS X 10.5 mails !

-- 
Antonin Perrot-Audet
Electrical Engineering&  Computer Sciences, INSA Lyon
M2 GEGP Signal&  Image Processing, INSA Lyon, UCBL, Centrale Lyon




More information about the vtkusers mailing list