[Insight-users] QtITK Problem
Gheorghe Postelnicu
gheorghe.postelnicu at gmail.com
Mon Nov 21 14:16:31 EST 2005
Hi Julien,
Thanks for all the help you provided last week. I think I have finally
managed to identify the source of the problem I had last week. Indeed, I was
receiving quite a lot of `undefined vtable for....` errors and these, as I
have found mentions on some Qt troubleshooting mailing-list, indicate that
moc has not run properly on the apropriate headers (these being header files
which contain a Q_OBJECT macro).
Consequently, I ran moc manually on the 2 header files concerned, namely
itkQtLightIndicator.h and itkQtAdaptor.h and then replaced the appropriate
inclusions in qtITK.cxx.
The good news is that the project compiled AND LINKED after this. It is even
running!
So, thanks again for all the help. It would seem there are some issues
concerning the integration of CMake with Qt. I am saying this because I also
had to comment the condition for the QT_WRAP_CPP:
#IF(QT_WRAP_CPP)
# QT_WRAP_CPP(QtITK QtITK_SRCS QtITK_MOC_SRCS)
#ENDIF(QT_WRAP_CPP)
Knowing that running moc is what causes the problem, do you have any
suggestions for permanently fixing this?
Thanks again,
On 11/16/05, Julien Jomier <jjomier at cs.unc.edu> wrote:
>
> Hi Gheorghe,
>
> To the best of my knowledge there is no example in InsightApplications
> working with Qt 3.3.
> You might be able to convert the example to use Qt 3.3 or maybe someone
> on the list has a small example (I'll be happy to add it into
> InsightApplications with the appropriate credits).
>
> If you want you can log a feature request on the bug tracker
> (http://www.itk.org/Bug) and assign it to me.
>
> Julien
>
> Gheorghe Postelnicu wrote:
> > Hi Julien,
> >
> > Indeed, I am using Qt 3.3 (the default installed on my laptop).
> >
> > Is there any other example that uses jointly ITK and Qt?
> >
> > Thanks,
> >
> > On 11/16/05, *Julien Jomier* <jjomier at cs.unc.edu
> > <mailto:jjomier at cs.unc.edu>> wrote:
> >
> > Hi Gheorghe,
> >
> > What version of Qt are you using? This example works only with Qt 2.3
> >
> > Let us know,
> >
> > Julien
> >
> > Gheorghe Postelnicu wrote:
> > > Hi Julien,
> > >
> > > Thanks alot for the help!
> > >
> > > Now I seem to have some linking problems. I should mention that I am
> > > using ccmake version 2.2-patch 2 and I receive the following errors:
> > >
> > > --
> > > Linking CXX executable QtITK
> > >
> >
> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.t._ZN3itk16QtLightIndicatorD1Ev+0x13):
> >
> > > In function `itk::QtLightIndicator::~QtLightIndicator()':
> > > : undefined reference to `vtable for itk::QtLightIndicator'
> > >
> >
> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.t._ZN3itk16QtLightIndicatorD1Ev+0x1f):
> >
> > > In function `itk::QtLightIndicator::~QtLightIndicator()':
> > > : undefined reference to `vtable for itk::QtLightIndicator'
> > >
> >
> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.t._ZN3itk12QtTranslatorD2Ev+0xb):
> > > In function `itk::QtTranslator::~QtTranslator()':
> > > : undefined reference to `vtable for itk::QtTranslator'
> > >
> >
> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.t._ZN3itk15QtSignalAdaptor10EmitSignalEv+0xd):
> > > In function `itk::QtSignalAdaptor::EmitSignal()':
> > > : undefined reference to `itk::QtTranslator::Signal()'
> > >
> >
> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.t._ZN3itk12QtTranslatorC2Ev+0x1d):
> > > In function `itk::QtTranslator::QtTranslator()':
> > > : undefined reference to `vtable for itk::QtTranslator'
> > >
> >
> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.t._ZN3itk16QtLightIndicatorC1EP7QWidgetPc+0x1e):
> > > In function `itk::QtLightIndicator::QtLightIndicator(QWidget*,
> > char*)':
> > > : undefined reference to `vtable for itk::QtLightIndicator'
> > >
> >
> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.t._ZN3itk16QtLightIndicatorC1EP7QWidgetPc+0x2a):
> > > In function `itk::QtLightIndicator::QtLightIndicator(QWidget*,
> > char*)':
> > > : undefined reference to `vtable for itk::QtLightIndicator'
> > >
> >
> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTVN3itk13QtSlotAdaptorINS_14AddImageFilterINS_5ImageIfLj2EEES3_S3_EEEE+0xc):
> > > undefined reference to `itk::QtTranslator::className() const'
> > >
> >
> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTVN3itk13QtSlotAdaptorINS_14AddImageFilterINS_5ImageIfLj2EEES3_S3_EEEE+0x10):
> >
> > > undefined reference to `itk::QtTranslator::qt_cast(char const*)'
> > >
> >
> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTVN3itk13QtSlotAdaptorINS_14AddImageFilterINS_5ImageIfLj2EEES3_S3_EEEE+0x14):
> > > undefined reference to `itk::QtTranslator::qt_invoke(int,
> > QUObject*)'
> > >
> >
> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTVN3itk13QtSlotAdaptorINS_14AddImageFilterINS_5ImageIfLj2EEES3_S3_EEEE+0x18):
> > > undefined reference to `itk::QtTranslator::qt_emit(int, QUObject*)'
> > >
> >
> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTVN3itk13QtSlotAdaptorINS_14AddImageFilterINS_5ImageIfLj2EEES3_S3_EEEE+0x1c):
> >
> > > undefined reference to `itk::QtTranslator::qt_property(int, int,
> > QVariant*)'
> > >
> >
> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTVN3itk15QtSignalAdaptorE+0xc):
> > > undefined reference to `itk::QtTranslator::className() const'
> > >
> >
> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTVN3itk15QtSignalAdaptorE+0x10):
> > > undefined reference to `itk::QtTranslator::qt_cast(char const*)'
> > >
> >
> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTVN3itk15QtSignalAdaptorE+0x14):
> >
> > > undefined reference to `itk::QtTranslator::qt_invoke(int, QUObject*)'
> > >
> >
> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTVN3itk15QtSignalAdaptorE+0x18):
> > > undefined reference to `itk::QtTranslator::qt_emit(int, QUObject*)'
> > >
> >
> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTVN3itk15QtSignalAdaptorE+0x1c):
> > > undefined reference to `itk::QtTranslator::qt_property(int, int,
> > QVariant*)'
> > >
> >
> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.t._ZNK3itk12QtTranslator10metaObjectEv+0x7):
> >
> > > In function `itk::QtTranslator::metaObject() const':
> > > : undefined reference to `itk::QtTranslator::staticMetaObject()'
> > >
> >
> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTIN3itk15QtSignalAdaptorE+0x8):
> >
> > > undefined reference to `typeinfo for itk::QtTranslator'
> > >
> >
> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTIN3itk13QtSlotAdaptorINS_14AddImageFilterINS_5ImageIfLj2EEES3_S3_EEEE+0x8):
> > > undefined reference to `typeinfo for itk::QtTranslator'
> > > collect2: ld returned 1 exit status
> > > make[2]: *** [QtITK] Error 1
> > > make[1]: *** [CMakeFiles/QtITK.dir/all] Error 2
> > > make: *** [all] Error 2
> > >
> > > --
> > >
> > > I have seen you mention that this was a known problem with CMake
> > 2.0.2
> > > not wrapping cpp for Qt, so I uncommented the relevant lines. So
> > now my
> > > CMakeLists.txt looks like this:
> > >
> > > --
> > > PROJECT(QtITKExample)
> > >
> > > #IF( BUILD_OUTSIDE_INSIGHT_APPLICATIONS )
> > >
> > > FIND_PACKAGE(ITK)
> > > IF(ITK_FOUND)
> > > INCLUDE(${ITK_USE_FILE})
> > > ELSE(ITK_FOUND)
> > > MESSAGE(FATAL_ERROR
> > > "Cannot build InsightApplications without
> > ITK. Please set
> > > ITK_DIR.")
> > > ENDIF(ITK_FOUND)
> > >
> > > #ENDIF( BUILD_OUTSIDE_INSIGHT_APPLICATIONS )
> > >
> > > #
> > > # Find QT
> > > #
> > > INCLUDE (${CMAKE_ROOT}/Modules/FindQt.cmake)
> > >
> > > INCLUDE_DIRECTORIES(
> > > ${QT_INCLUDE_DIR}
> > > ${QT_INCLUDE_PATH}
> > > )
> > >
> > > LINK_LIBRARIES (
> > > ITKIO
> > > ITKCommon
> > > ITKBasicFilters
> > > ITKAlgorithms
> > > ITKIO
> > > itkpng
> > > itkzlib
> > > ${QT_QT_LIBRARY}
> > > )
> > >
> > > SET(QtITK_SRCS
> > > itkQtProgressBar.cxx
> > > qtITK.cxx
> > > )
> > >
> > > SET(QtITK_MOC_SRCS
> > > itkQtAdaptor.h
> > > itkQtLightIndicator.h
> > > )
> > >
> > > #IF(QT_WRAP_CPP)
> > > # QT_WRAP_CPP(QtITK QtITK_SRCS QtITK_MOC_SRCS)
> > > #ENDIF(QT_WRAP_CPP)
> > >
> > > QT_WRAP_CPP(QtITK ${QtITK_SRCS} ${QtITK_MOC_SRCS})
> > > ADD_EXECUTABLE(QtITK ${QtITK_SRCS})
> > >
> > > #ADD_EXECUTABLE(QtITK QtITK_SRCS)
> > >
> > > #INSTALL_TARGETS(/bin QtITK)
> > > --
> > >
> > > Thanks for the help,
> > >
> > > On 11/16/05, *Julien Jomier* < jjomier at cs.unc.edu
> > <mailto:jjomier at cs.unc.edu>
> > > <mailto:jjomier at cs.unc.edu <mailto:jjomier at cs.unc.edu>>> wrote:
> > >
> > > Hi Gheorghe,
> > >
> > > Try to replace
> > >
> > > QT_WRAP_CPP(QtITK QtITK_SRCS QtITK_MOC_SRCS)
> > > ADD_EXECUTABLE(QtITK QtITK_SRCS)
> > >
> > > by
> > >
> > > QT_WRAP_CPP(QtITK ${QtITK_SRCS} ${QtITK_MOC_SRCS})
> > > ADD_EXECUTABLE(QtITK ${QtITK_SRCS})
> > >
> > > Let us know if that works or not. I'll put a fix as soon as I
> > can.
> > >
> > > Thanks for the report,
> > >
> > > Julien
> > >
> > > Gheorghe Postelnicu wrote:
> > > > Hi,
> > > >
> > > > I have a problem when building the provided qtITK example.
> > Namely, I
> > > > receive the message
> > > >
> > > > CMake Error: can not find file
> > > /local/ghighi/code/workshop/itkqt/QtITK_SRCS
> > > >
> > > > when running ccmake .
> > > >
> > > > Here is my CMakeLists.txt file:
> > > >
> > > > --
> > > > PROJECT(QtITKExample)
> > > >
> > > > IF( BUILD_OUTSIDE_INSIGHT_APPLICATIONS )
> > > >
> > > > FIND_PACKAGE(ITK)
> > > > IF(ITK_FOUND)
> > > > INCLUDE(${ITK_USE_FILE})
> > > > ELSE(ITK_FOUND)
> > > > MESSAGE(FATAL_ERROR
> > > > "Cannot build InsightApplications without
> > > ITK. Please set
> > > > ITK_DIR.")
> > > > ENDIF(ITK_FOUND)
> > > >
> > > > ENDIF( BUILD_OUTSIDE_INSIGHT_APPLICATIONS )
> > > >
> > > > #
> > > > # Find QT
> > > > #
> > > > INCLUDE (${CMAKE_ROOT}/Modules/FindQt.cmake)
> > > >
> > > > INCLUDE_DIRECTORIES(
> > > > ${QT_INCLUDE_DIR}
> > > > ${QT_INCLUDE_PATH}
> > > > )
> > > >
> > > > LINK_LIBRARIES (
> > > > ITKIO
> > > > ${QT_QT_LIBRARY}
> > > > )
> > > >
> > > > SET(QtITK_SRCS
> > > > itkQtProgressBar.cxx
> > > > qtITK.cxx
> > > > )
> > > >
> > > > SET(QtITK_MOC_SRCS
> > > > itkQtAdaptor.h
> > > > itkQtLightIndicator.h
> > > > )
> > > >
> > > > #IF(QT_WRAP_CPP)
> > > > QT_WRAP_CPP(QtITK QtITK_SRCS QtITK_MOC_SRCS)
> > > > #ENDIF(QT_WRAP_CPP)
> > > >
> > > >
> > > > ADD_EXECUTABLE(QtITK QtITK_SRCS)
> > > >
> > > > #INSTALL_TARGETS(/bin QtITK)
> > > >
> > > >
> > > > --
> > > >
> > > > I am using
> > > > ccmake version 2.2-patch 2
> > > >
> > > > Thanks,
> > > > --
> > > > Gheorghe
> > > >
> > > >
> > > >
> > > >
> > >
> > ------------------------------------------------------------------------
> >
> > > >
> > > > _______________________________________________
> > > > Insight-users mailing list
> > > > Insight-users at itk.org <mailto:Insight-users at itk.org>
> > <mailto: Insight-users at itk.org <mailto:Insight-users at itk.org>>
> > > > http://www.itk.org/mailman/listinfo/insight-users
> > > < http://www.itk.org/mailman/listinfo/insight-users>
> > >
> > >
> > >
> > >
> > > --
> > > Gheorghe Postelnicu, PhD
> > > MGH, Harvard Medical School
> >
> >
> >
> >
> > --
> > Gheorghe Postelnicu, PhD
> > MGH, Harvard Medical School
>
>
--
Gheorghe Postelnicu, PhD
MGH, Harvard Medical School
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20051121/2fc43b40/attachment-0001.html
More information about the Insight-users
mailing list