[ITK Community] [Insight-users] QtITK Bluiding problem (linking problem) please help

Adem breckon adem.breckon at gmail.com
Fri Nov 8 10:43:59 EST 2013


Hi

I want to run QtITK ( taken from InsightApplications) as I want to do a Qt
based Gui for my itk application.

I used the following CMakeLists file:

PROJECT(myProject)



FIND_PACKAGE ( ITK)

IF ( ITK_FOUND)

INCLUDE( ${USE_ITK_FILE} )

ENDIF( ITK_FOUND)





# Find QT

FIND_PACKAGE( Qt4   REQUIRED )

#INCLUDE( ${QT_USE_FILE} )



INCLUDE_DIRECTORIES(

  ${QT_INCLUDES}

  ${QT_INCLUDE_DIR}

  ${QT_QTGUI_INCLUDE_DIR}

  ${QT_QTCORE_INCLUDE_DIR}

  ${CMAKE_CURRENT_BINARY_DIR}

  ${CMAKE_CURRENT_SOURCE_DIR}

  )





LINK_LIBRARIES (QtITK

${ITK_LIBRARIES}

${QT_LIBRARIES}

${QT_QTCORE_LIBRARY}

${QT_QTGUI_LIBRARY}

)





SET( QtITK.cpp 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.cpp)



I successfully configured it using cmake and when I try to build the
solution using VS 2008 I got the following link errors:



Warning               1              warning C4996: 'std::copy': Function
call with parameters that may be unsafe - this call relies on the caller to
check that the passed values are correct. To disable this warning, use
-D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++
'Checked Iterators'
c:\tools\itk_4.4.2\itk_4.4.2\modules\io\imagebase\include\itkImageFileReader.hxx
439         QtITK

Warning               2              warning C4996: 'std::copy': Function
call with parameters that may be unsafe - this call relies on the caller to
check that the passed values are correct. To disable this warning, use
-D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++
'Checked Iterators'
c:\tools\itk_4.4.2\itk_4.4.2\modules\core\common\include\itkImportImageContainer.hxx
72           QtITK

Error      3              error LNK2019: unresolved external symbol
"public: void __thiscall itk::QtProgressBar::Observe(class itk::Object *)"
(?Observe at QtProgressBar@itk@@QAEXPAVObject at 2@@Z) referenced in function
_main        QtITK.obj                QtITK

Error      4              error LNK2019: unresolved external symbol
"public: __thiscall itk::QtProgressBar::QtProgressBar(class QWidget *)"
(??0QtProgressBar at itk@@QAE at PAVQWidget@@@Z) referenced in function _main
QtITK.obj                QtITK

Error      5              error LNK2001: unresolved external symbol
"public: virtual struct QMetaObject const * __thiscall
itk::QtTranslator::metaObject(void)const " (?metaObject at QtTranslator@itk@
@UBEPBUQMetaObject@@XZ) QtITK.obj                QtITK

Error      6              error LNK2001: unresolved external symbol
"public: virtual void * __thiscall itk::QtTranslator::qt_metacast(char
const *)" (?qt_metacast at QtTranslator@itk@@UAEPAXPBD at Z)     QtITK.obj
QtITK

Error      7              error LNK2001: unresolved external symbol
"public: virtual int __thiscall itk::QtTranslator::qt_metacall(enum
QMetaObject::Call,int,void * *)" (?qt_metacall at QtTranslator@itk@
@UAEHW4Call at QMetaObject@@HPAPAX at Z)             QtITK.obj             QtITK

Error      8              error LNK2019: unresolved external symbol
"protected: void __thiscall itk::QtTranslator::Signal(void)"
(?Signal at QtTranslator@itk@@IAEXXZ) referenced in function "public: void
__thiscall itk::QtSignalAdaptor::EmitSignal(void)"
(?EmitSignal at QtSignalAdaptor@itk@@QAEXXZ)              QtITK.obj
QtITK

Error      9              error LNK2001: unresolved external symbol
"public: virtual struct QMetaObject const * __thiscall
itk::QtLightIndicator::metaObject(void)const " (?metaObject at QtLightIndicator
@itk@@UBEPBUQMetaObject@@XZ)                QtITK.obj             QtITK

Error      10           error LNK2001: unresolved external symbol "public:
virtual void * __thiscall itk::QtLightIndicator::qt_metacast(char const *)"
(?qt_metacast at QtLightIndicator@itk@@UAEPAXPBD at Z)      QtITK.obj
QtITK

Error      11           error LNK2001: unresolved external symbol "public:
virtual int __thiscall itk::QtLightIndicator::qt_metacall(enum
QMetaObject::Call,int,void * *)" (?qt_metacall at QtLightIndicator@itk@
@UAEHW4Call at QMetaObject@@HPAPAX at Z)     QtITK.obj             QtITK

Error      12           fatal error LNK1120: 9 unresolved externals
C:\MyCodes\QT_GUI5\Bin\Debug\QtITK.exe    QtITK



Of course I have putt all the files needed in my bin directory:
itkQtProgressBar.cxx,
itkQtProgressBar.h itkQtAdaptor.h, itkQtLightIndicator.h


but still got this linking problem. I used  qt4.8.5 and itk 4.4.2
version,  Cmake
(2.8.11.2),  VS. 2008.

I am using QtITK from InsightApplications-4.4.0.


I searched in itk mailing list and I found two messages asking the same
question

in http://www.itk.org/pipermail/insight-users/2004-July/009627.html

they suggest that CMake  not wrapping cpp for Qt.

As you can see in my CMakeLists file, I already comment out that but still
having the same errors.



In http://www.itk.org/pipermail/insight-users/2005-November/015684.html

The author said that moc has not run properly on the appropriate
headers (itkQtAdaptor.h,
itkQtLightIndicator.h) so he has done this manually and the problem is
resolved.



I don’t really know the meaning of that and how to do it.



Could you please help as I am really stack in using QT with itk. No
application is running for me. I have already posted my problem with
QtImageViewer
and I still waiting or help.

Does anyone have a working application wusing itk and QT…please help.

Adem.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20131108/261db03a/attachment.html>
-------------- next part --------------
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users


More information about the Community mailing list