Hi Julien,<br>
<br>
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).<br>
<br>
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.<br>
<br>
The good news is that the project compiled AND LINKED after this. It is even running!<br>
<br>
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:<br>
<br>
#IF(QT_WRAP_CPP)<br>
# QT_WRAP_CPP(QtITK QtITK_SRCS QtITK_MOC_SRCS)<br>
#ENDIF(QT_WRAP_CPP)<br>
<br>
Knowing that running moc is what causes the problem, do you have any suggestions for permanently fixing this?<br>
<br>
Thanks again,<br>
<br><br><div><span class="gmail_quote">On 11/16/05, <b class="gmail_sendername">Julien Jomier</b> <<a href="mailto:jjomier@cs.unc.edu">jjomier@cs.unc.edu</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Gheorghe,<br><br>To the best of my knowledge there is no example in InsightApplications<br>working with Qt 3.3.<br>You might be able to convert the example to use Qt 3.3 or maybe someone<br>on the list has a small example (I'll be happy to add it into
<br>InsightApplications with the appropriate credits).<br><br>If you want you can log a feature request on the bug tracker<br>(<a href="http://www.itk.org/Bug">http://www.itk.org/Bug</a>) and assign it to me.<br><br>Julien
<br><br>Gheorghe Postelnicu wrote:<br>> Hi Julien,<br>><br>> Indeed, I am using Qt 3.3 (the default installed on my laptop).<br>><br>> Is there any other example that uses jointly ITK and Qt?<br>><br>> Thanks,
<br>><br>> On 11/16/05, *Julien Jomier* <<a href="mailto:jjomier@cs.unc.edu">jjomier@cs.unc.edu</a><br>> <mailto:<a href="mailto:jjomier@cs.unc.edu">jjomier@cs.unc.edu</a>>> wrote:<br>><br>> Hi Gheorghe,
<br>><br>> What version of Qt are you using? This example works only with Qt 2.3<br>><br>> Let us know,<br>><br>> Julien<br>><br>> Gheorghe Postelnicu wrote:<br>> > Hi Julien,
<br>> ><br>> > Thanks alot for the help!<br>> ><br>> > Now I seem to have some linking problems. I should mention that I am<br>> > using ccmake version 2.2-patch 2 and I receive the following errors:
<br>> ><br>> > --<br>> > Linking CXX executable QtITK<br>> ><br>> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.t._ZN3itk16QtLightIndicatorD1Ev+0x13):<br>><br>> > In function `itk::QtLightIndicator::~QtLightIndicator()':
<br>> > : undefined reference to `vtable for itk::QtLightIndicator'<br>> ><br>> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.t._ZN3itk16QtLightIndicatorD1Ev+0x1f):<br>><br>> > In function `itk::QtLightIndicator::~QtLightIndicator()':
<br>> > : undefined reference to `vtable for itk::QtLightIndicator'<br>> ><br>> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.t._ZN3itk12QtTranslatorD2Ev+0xb):<br>> > In function `itk::QtTranslator::~QtTranslator()':
<br>> > : undefined reference to `vtable for itk::QtTranslator'<br>> ><br>> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.t._ZN3itk15QtSignalAdaptor10EmitSignalEv+0xd):<br>> > In function `itk::QtSignalAdaptor::EmitSignal()':
<br>> > : undefined reference to `itk::QtTranslator::Signal()'<br>> ><br>> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.t._ZN3itk12QtTranslatorC2Ev+0x1d):<br>> > In function `itk::QtTranslator::QtTranslator()':
<br>> > : undefined reference to `vtable for itk::QtTranslator'<br>> ><br>> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.t._ZN3itk16QtLightIndicatorC1EP7QWidgetPc+0x1e):<br>> > In function `itk::QtLightIndicator::QtLightIndicator(QWidget*,
<br>> char*)':<br>> > : undefined reference to `vtable for itk::QtLightIndicator'<br>> ><br>> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.t._ZN3itk16QtLightIndicatorC1EP7QWidgetPc+0x2a):
<br>> > In function `itk::QtLightIndicator::QtLightIndicator(QWidget*,<br>> char*)':<br>> > : undefined reference to `vtable for itk::QtLightIndicator'<br>> ><br>> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTVN3itk13QtSlotAdaptorINS_14AddImageFilterINS_5ImageIfLj2EEES3_S3_EEEE+0xc):
<br>> > undefined reference to `itk::QtTranslator::className() const'<br>> ><br>> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTVN3itk13QtSlotAdaptorINS_14AddImageFilterINS_5ImageIfLj2EEES3_S3_EEEE+0x10):
<br>><br>> > undefined reference to `itk::QtTranslator::qt_cast(char const*)'<br>> ><br>> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTVN3itk13QtSlotAdaptorINS_14AddImageFilterINS_5ImageIfLj2EEES3_S3_EEEE+0x14):
<br>> > undefined reference to `itk::QtTranslator::qt_invoke(int,<br>> QUObject*)'<br>> ><br>> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTVN3itk13QtSlotAdaptorINS_14AddImageFilterINS_5ImageIfLj2EEES3_S3_EEEE+0x18):
<br>> > undefined reference to `itk::QtTranslator::qt_emit(int, QUObject*)'<br>> ><br>> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTVN3itk13QtSlotAdaptorINS_14AddImageFilterINS_5ImageIfLj2EEES3_S3_EEEE+0x1c):
<br>><br>> > undefined reference to `itk::QtTranslator::qt_property(int, int,<br>> QVariant*)'<br>> ><br>> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTVN3itk15QtSignalAdaptorE+0xc):
<br>> > undefined reference to `itk::QtTranslator::className() const'<br>> ><br>> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTVN3itk15QtSignalAdaptorE+0x10):<br>> > undefined reference to `itk::QtTranslator::qt_cast(char const*)'
<br>> ><br>> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTVN3itk15QtSignalAdaptorE+0x14):<br>><br>> > undefined reference to `itk::QtTranslator::qt_invoke(int, QUObject*)'<br>> >
<br>> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTVN3itk15QtSignalAdaptorE+0x18):<br>> > undefined reference to `itk::QtTranslator::qt_emit(int, QUObject*)'<br>> ><br>> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTVN3itk15QtSignalAdaptorE+0x1c):
<br>> > undefined reference to `itk::QtTranslator::qt_property(int, int,<br>> QVariant*)'<br>> ><br>> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.t._ZNK3itk12QtTranslator10metaObjectEv+0x7):
<br>><br>> > In function `itk::QtTranslator::metaObject() const':<br>> > : undefined reference to `itk::QtTranslator::staticMetaObject()'<br>> ><br>> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTIN3itk15QtSignalAdaptorE+0x8):
<br>><br>> > undefined reference to `typeinfo for itk::QtTranslator'<br>> ><br>> CMakeFiles/QtITK.dir/qtITK.o(.gnu.linkonce.r._ZTIN3itk13QtSlotAdaptorINS_14AddImageFilterINS_5ImageIfLj2EEES3_S3_EEEE+0x8):
<br>> > undefined reference to `typeinfo for itk::QtTranslator'<br>> > collect2: ld returned 1 exit status<br>> > make[2]: *** [QtITK] Error 1<br>> > make[1]: *** [CMakeFiles/QtITK.dir/all] Error 2
<br>> > make: *** [all] Error 2<br>> ><br>> > --<br>> ><br>> > I have seen you mention that this was a known problem with CMake<br>> 2.0.2<br>> > not wrapping cpp for Qt, so I uncommented the relevant lines. So
<br>> now my<br>> > CMakeLists.txt looks like this:<br>> ><br>> > --<br>> > PROJECT(QtITKExample)<br>> ><br>> > #IF( BUILD_OUTSIDE_INSIGHT_APPLICATIONS )
<br>> ><br>> > FIND_PACKAGE(ITK)<br>> > IF(ITK_FOUND)<br>> > INCLUDE(${ITK_USE_FILE})<br>> > ELSE(ITK_FOUND)<br>> > MESSAGE(FATAL_ERROR<br>> >
"Cannot build InsightApplications without<br>> ITK. Please set<br>> > ITK_DIR.")<br>> > ENDIF(ITK_FOUND)<br>> ><br>> > #ENDIF( BUILD_OUTSIDE_INSIGHT_APPLICATIONS )
<br>> ><br>> > #<br>> > # Find QT<br>> > #<br>> > INCLUDE (${CMAKE_ROOT}/Modules/FindQt.cmake)<br>> ><br>> > INCLUDE_DIRECTORIES(<br>> > ${QT_INCLUDE_DIR}
<br>> > ${QT_INCLUDE_PATH}<br>> > )<br>> ><br>> > LINK_LIBRARIES (<br>> > ITKIO<br>> > ITKCommon<br>> > ITKBasicFilters<br>> > ITKAlgorithms
<br>> > ITKIO<br>> > itkpng<br>> > itkzlib<br>> > ${QT_QT_LIBRARY}<br>> > )<br>> ><br>> > SET(QtITK_SRCS<br>> > itkQtProgressBar.cxx<br>
> > qtITK.cxx<br>> > )<br>> ><br>> > SET(QtITK_MOC_SRCS<br>> > itkQtAdaptor.h<br>> > itkQtLightIndicator.h<br>> > )<br>> ><br>> > #IF(QT_WRAP_CPP)
<br>> > # QT_WRAP_CPP(QtITK QtITK_SRCS QtITK_MOC_SRCS)<br>> > #ENDIF(QT_WRAP_CPP)<br>> ><br>> > QT_WRAP_CPP(QtITK ${QtITK_SRCS} ${QtITK_MOC_SRCS})<br>> > ADD_EXECUTABLE(QtITK ${QtITK_SRCS})
<br>> ><br>> > #ADD_EXECUTABLE(QtITK QtITK_SRCS)<br>> ><br>> > #INSTALL_TARGETS(/bin QtITK)<br>> > --<br>> ><br>> > Thanks for the help,<br>> >
<br>> > On 11/16/05, *Julien Jomier* < <a href="mailto:jjomier@cs.unc.edu">jjomier@cs.unc.edu</a><br>> <mailto:<a href="mailto:jjomier@cs.unc.edu">jjomier@cs.unc.edu</a>><br>> > <mailto:
<a href="mailto:jjomier@cs.unc.edu">jjomier@cs.unc.edu</a> <mailto:<a href="mailto:jjomier@cs.unc.edu">jjomier@cs.unc.edu</a>>>> wrote:<br>> ><br>> > Hi Gheorghe,<br>> ><br>
> > Try to replace<br>> ><br>> > QT_WRAP_CPP(QtITK QtITK_SRCS QtITK_MOC_SRCS)<br>> > ADD_EXECUTABLE(QtITK QtITK_SRCS)<br>> ><br>> > by<br>> >
<br>> > QT_WRAP_CPP(QtITK ${QtITK_SRCS} ${QtITK_MOC_SRCS})<br>> > ADD_EXECUTABLE(QtITK ${QtITK_SRCS})<br>> ><br>> >
Let us know if that works or not. I'll put a fix as soon as I<br>> can.<br>> ><br>> > Thanks for the report,<br>> ><br>> > Julien<br>> ><br>> > Gheorghe Postelnicu wrote:
<br>> > > Hi,<br>> > ><br>> > >
I have a problem when building the provided qtITK example.<br>> Namely, I<br>> > > receive the message<br>> > ><br>> > > CMake Error: can not find file<br>> > /local/ghighi/code/workshop/itkqt/QtITK_SRCS
<br>> > ><br>> > > when running ccmake .<br>> > ><br>> > > Here is my CMakeLists.txt file:<br>> > ><br>> > > --
<br>> > > PROJECT(QtITKExample)<br>> > ><br>> > > IF( BUILD_OUTSIDE_INSIGHT_APPLICATIONS )<br>> > ><br>> > > FIND_PACKAGE(ITK)
<br>> > > IF(ITK_FOUND)<br>> > >
INCLUDE(${ITK_USE_FILE})<br>> > > ELSE(ITK_FOUND)<br>> > > MESSAGE(FATAL_ERROR<br>> > >
"Cannot build InsightApplications without<br>> > ITK. Please set<br>> > > ITK_DIR.")<br>> > > ENDIF(ITK_FOUND)<br>> > ><br>> > > ENDIF( BUILD_OUTSIDE_INSIGHT_APPLICATIONS )
<br>> > ><br>> > > #<br>> > > # Find QT<br>> > > #<br>> > > INCLUDE (${CMAKE_ROOT}/Modules/FindQt.cmake)<br>> > >
<br>> > > INCLUDE_DIRECTORIES(<br>> > > ${QT_INCLUDE_DIR}<br>> > > ${QT_INCLUDE_PATH}<br>> > > )<br>> > ><br>> > > LINK_LIBRARIES (
<br>> > > ITKIO<br>> > > ${QT_QT_LIBRARY}<br>> > > )<br>> > ><br>> > > SET(QtITK_SRCS<br>> > > itkQtProgressBar.cxx
<br>> > > qtITK.cxx<br>> > > )<br>> > ><br>> > > SET(QtITK_MOC_SRCS<br>> > > itkQtAdaptor.h<br>> > > itkQtLightIndicator.h
<br>> > > )<br>> > ><br>> > > #IF(QT_WRAP_CPP)<br>> > >
QT_WRAP_CPP(QtITK QtITK_SRCS QtITK_MOC_SRCS)<br>> > > #ENDIF(QT_WRAP_CPP)<br>> > ><br>> > ><br>> > > ADD_EXECUTABLE(QtITK QtITK_SRCS)<br>> > >
<br>> > > #INSTALL_TARGETS(/bin QtITK)<br>> > ><br>> > ><br>> > > --<br>> > ><br>> > > I am using<br>> > > ccmake version
2.2-patch 2<br>> > ><br>> > > Thanks,<br>> > > --<br>> > > Gheorghe<br>> > ><br>> > ><br>> > >
<br>> > ><br>> ><br>> ------------------------------------------------------------------------<br>><br>> > ><br>> > > _______________________________________________
<br>> > > Insight-users mailing list<br>> > >
<a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a> <mailto:<a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a>><br>> <mailto: <a href="mailto:Insight-users@itk.org">Insight-users@itk.org
</a> <mailto:<a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a>>><br>> > > <a href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users
</a><br>> > < <a href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a>><br>> ><br>> ><br>> ><br>> >
<br>> > --<br>> > Gheorghe Postelnicu, PhD<br>> > MGH, Harvard Medical School<br>><br>><br>><br>><br>> --<br>> Gheorghe Postelnicu, PhD<br>> MGH, Harvard Medical School
<br><br></blockquote></div><br><br clear="all"><br>-- <br>Gheorghe Postelnicu, PhD<br>MGH, Harvard Medical School