[vtkusers] VTK with QT, linking problem with uic ?
Antonin Perrot-Audet
antonin07130 at gmail.com
Thu Apr 29 19:10:28 EDT 2010
On 4/29/10 6:17 PM, Antonin Perrot-Audet wrote:
> 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 !
>
Hello Antonin,
(I let myself answer to my previous question :) you just forgot to add
the QVTK libraries to your VTK_LIBRARIES
Antonin
More information about the vtkusers
mailing list