<div dir="ltr"><div>Hi Matt,</div><div> I changed CMakeLists.txt as you suggested as follows:</div><div> </div><div><span lang="EN-GB"><p>PROJECT(myProject)</p>
<p>FIND_PACKAGE ( ITK)</p>
<p>IF ( ITK_FOUND)</p>
<p>INCLUDE( ${USE_ITK_FILE} )</p>
<p>ENDIF( ITK_FOUND)</p>
<p> </p>
<p># Find QT</p>
<p>FIND_PACKAGE( Qt4 REQUIRED )</p>
<p>#INCLUDE( ${QT_USE_FILE} )</p>
<p>INCLUDE_DIRECTORIES(</p>
<p> ${QT_INCLUDES}</p>
<p> ${QT_INCLUDE_DIR}</p>
<p> ${QT_QTGUI_INCLUDE_DIR}</p>
<p> ${QT_QTCORE_INCLUDE_DIR}</p>
<p> ${CMAKE_CURRENT_BINARY_DIR}</p>
<p> ${CMAKE_CURRENT_SOURCE_DIR}</p>
<p> )</p>
<p> </p>
<p>SET( QtITK.cpp itkQtProgressBar.cxx qtITK.cxx)</p>
<p>SET( QtITK_MOC_SRCS itkQtAdaptor.h itkQtLightIndicator.h)</p>
<p>#IF(QT_WRAP_CPP)</p>
<p> # QT_WRAP_CPP(QtITK QtITK_SRCS QtITK_MOC_SRCS)</p>
<p>#ENDIF(QT_WRAP_CPP</p>
<p>ADD_EXECUTABLE( QtITK QtITK.cxx)</p>
<p>TARGET_LINK_LIBRARIES (QtITK </p>
<p>${ITK_LIBRARIES} </p>
<p>${QT_LIBRARIES} </p>
<p>${QT_QTCORE_LIBRARY}</p>
<p>${QT_QTGUI_LIBRARY}</p>
<p>)</p><p> </p><p> </p><p>But I still got the same linking error? any other suggestions?</p><p>Thanks,</p><p>Adem.</p></span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 8 November 2013 17:25, Matt McCormick <span dir="ltr"><<a href="mailto:matt.mccormick@kitware.com" target="_blank">matt.mccormick@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Adem,<br>
<br>
The CMakeLists.txt needs to be updated. The link_libraries command is<br>
deprecated in favor of target_link_libraries. This should come after<br>
the add_executable call. More work may be required.<br>
<br>
Thanks,<br>
Matt<br>
<div><div class="h5"><br>
On Fri, Nov 8, 2013 at 10:43 AM, Adem breckon <<a href="mailto:adem.breckon@gmail.com">adem.breckon@gmail.com</a>> wrote:<br>
> Hi<br>
><br>
> I want to run QtITK ( taken from InsightApplications) as I want to do a Qt<br>
> based Gui for my itk application.<br>
><br>
> I used the following CMakeLists file:<br>
><br>
> PROJECT(myProject)<br>
><br>
><br>
><br>
> FIND_PACKAGE ( ITK)<br>
><br>
> IF ( ITK_FOUND)<br>
><br>
> INCLUDE( ${USE_ITK_FILE} )<br>
><br>
> ENDIF( ITK_FOUND)<br>
><br>
><br>
><br>
><br>
><br>
> # Find QT<br>
><br>
> FIND_PACKAGE( Qt4 REQUIRED )<br>
><br>
> #INCLUDE( ${QT_USE_FILE} )<br>
><br>
><br>
><br>
> INCLUDE_DIRECTORIES(<br>
><br>
> ${QT_INCLUDES}<br>
><br>
> ${QT_INCLUDE_DIR}<br>
><br>
> ${QT_QTGUI_INCLUDE_DIR}<br>
><br>
> ${QT_QTCORE_INCLUDE_DIR}<br>
><br>
> ${CMAKE_CURRENT_BINARY_DIR}<br>
><br>
> ${CMAKE_CURRENT_SOURCE_DIR}<br>
><br>
> )<br>
><br>
><br>
><br>
><br>
><br>
> LINK_LIBRARIES (QtITK<br>
><br>
> ${ITK_LIBRARIES}<br>
><br>
> ${QT_LIBRARIES}<br>
><br>
> ${QT_QTCORE_LIBRARY}<br>
><br>
> ${QT_QTGUI_LIBRARY}<br>
><br>
> )<br>
><br>
><br>
><br>
><br>
><br>
> SET( QtITK.cpp itkQtProgressBar.cxx qtITK.cxx)<br>
><br>
><br>
><br>
> SET( QtITK_MOC_SRCS itkQtAdaptor.h itkQtLightIndicator.h)<br>
><br>
><br>
><br>
> #IF(QT_WRAP_CPP)<br>
><br>
> # QT_WRAP_CPP(QtITK QtITK_SRCS QtITK_MOC_SRCS)<br>
><br>
> #ENDIF(QT_WRAP_CPP<br>
><br>
><br>
><br>
> ADD_EXECUTABLE( QtITK QtITK.cpp)<br>
><br>
><br>
><br>
> I successfully configured it using cmake and when I try to build the<br>
> solution using VS 2008 I got the following link errors:<br>
><br>
><br>
><br>
> Warning 1 warning C4996: 'std::copy': Function<br>
> call with parameters that may be unsafe - this call relies on the caller to<br>
> check that the passed values are correct. To disable this warning, use<br>
> -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++<br>
> 'Checked Iterators'<br>
> c:\tools\itk_4.4.2\itk_4.4.2\modules\io\imagebase\include\itkImageFileReader.hxx<br>
> 439 QtITK<br>
><br>
> Warning 2 warning C4996: 'std::copy': Function<br>
> call with parameters that may be unsafe - this call relies on the caller to<br>
> check that the passed values are correct. To disable this warning, use<br>
> -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++<br>
> 'Checked Iterators'<br>
> c:\tools\itk_4.4.2\itk_4.4.2\modules\core\common\include\itkImportImageContainer.hxx<br>
> 72 QtITK<br>
><br>
> Error 3 error LNK2019: unresolved external symbol "public:<br>
> void __thiscall itk::QtProgressBar::Observe(class itk::Object *)"<br>
> (?Observe@QtProgressBar@itk@@QAEXPAVObject@2@@Z) referenced in function<br>
> _main QtITK.obj QtITK<br>
><br>
> Error 4 error LNK2019: unresolved external symbol "public:<br>
> __thiscall itk::QtProgressBar::QtProgressBar(class QWidget *)"<br>
> (??0QtProgressBar@itk@@QAE@PAVQWidget@@@Z) referenced in function _main<br>
> QtITK.obj QtITK<br>
><br>
> Error 5 error LNK2001: unresolved external symbol "public:<br>
> virtual struct QMetaObject const * __thiscall<br>
> itk::QtTranslator::metaObject(void)const "<br>
> (?metaObject@QtTranslator@itk@@UBEPBUQMetaObject@@XZ) QtITK.obj<br>
> QtITK<br>
><br>
> Error 6 error LNK2001: unresolved external symbol "public:<br>
> virtual void * __thiscall itk::QtTranslator::qt_metacast(char const *)"<br>
> (?qt_metacast@QtTranslator@itk@@UAEPAXPBD@Z) QtITK.obj<br>
> QtITK<br>
><br>
> Error 7 error LNK2001: unresolved external symbol "public:<br>
> virtual int __thiscall itk::QtTranslator::qt_metacall(enum<br>
> QMetaObject::Call,int,void * *)"<br>
> (?qt_metacall@QtTranslator@itk@@UAEHW4Call@QMetaObject@@HPAPAX@Z)<br>
> QtITK.obj QtITK<br>
><br>
> Error 8 error LNK2019: unresolved external symbol<br>
> "protected: void __thiscall itk::QtTranslator::Signal(void)"<br>
> (?Signal@QtTranslator@itk@@IAEXXZ) referenced in function "public: void<br>
> __thiscall itk::QtSignalAdaptor::EmitSignal(void)"<br>
> (?EmitSignal@QtSignalAdaptor@itk@@QAEXXZ) QtITK.obj<br>
> QtITK<br>
><br>
> Error 9 error LNK2001: unresolved external symbol "public:<br>
> virtual struct QMetaObject const * __thiscall<br>
> itk::QtLightIndicator::metaObject(void)const "<br>
> (?metaObject@QtLightIndicator@itk@@UBEPBUQMetaObject@@XZ)<br>
> QtITK.obj QtITK<br>
><br>
> Error 10 error LNK2001: unresolved external symbol "public:<br>
> virtual void * __thiscall itk::QtLightIndicator::qt_metacast(char const *)"<br>
> (?qt_metacast@QtLightIndicator@itk@@UAEPAXPBD@Z) QtITK.obj<br>
> QtITK<br>
><br>
> Error 11 error LNK2001: unresolved external symbol "public:<br>
> virtual int __thiscall itk::QtLightIndicator::qt_metacall(enum<br>
> QMetaObject::Call,int,void * *)"<br>
> (?qt_metacall@QtLightIndicator@itk@@UAEHW4Call@QMetaObject@@HPAPAX@Z)<br>
> QtITK.obj QtITK<br>
><br>
> Error 12 fatal error LNK1120: 9 unresolved externals<br>
> C:\MyCodes\QT_GUI5\Bin\Debug\QtITK.exe QtITK<br>
><br>
><br>
><br>
> Of course I have putt all the files needed in my bin directory:<br>
> itkQtProgressBar.cxx, itkQtProgressBar.h itkQtAdaptor.h,<br>
> itkQtLightIndicator.h<br>
><br>
><br>
><br>
> but still got this linking problem. I used qt4.8.5 and itk 4.4.2 version,<br>
> Cmake (2.8.11.2), VS. 2008.<br>
><br>
> I am using QtITK from InsightApplications-4.4.0.<br>
><br>
><br>
><br>
> I searched in itk mailing list and I found two messages asking the same<br>
> question<br>
><br>
> in <a href="http://www.itk.org/pipermail/insight-users/2004-July/009627.html" target="_blank">http://www.itk.org/pipermail/insight-users/2004-July/009627.html</a><br>
><br>
> they suggest that CMake not wrapping cpp for Qt.<br>
><br>
> As you can see in my CMakeLists file, I already comment out that but still<br>
> having the same errors.<br>
><br>
><br>
><br>
> In <a href="http://www.itk.org/pipermail/insight-users/2005-November/015684.html" target="_blank">http://www.itk.org/pipermail/insight-users/2005-November/015684.html</a><br>
><br>
> The author said that moc has not run properly on the appropriate headers<br>
> (itkQtAdaptor.h, itkQtLightIndicator.h) so he has done this manually and the<br>
> problem is resolved.<br>
><br>
><br>
><br>
> I don’t really know the meaning of that and how to do it.<br>
><br>
><br>
><br>
> Could you please help as I am really stack in using QT with itk. No<br>
> application is running for me. I have already posted my problem with<br>
> QtImageViewer and I still waiting or help.<br>
><br>
> Does anyone have a working application wusing itk and QT…please help.<br>
><br>
> Adem.<br>
><br>
><br>
</div></div>> _____________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
><br>
> _______________________________________________<br>
> Community mailing list<br>
> <a href="mailto:Community@itk.org">Community@itk.org</a><br>
> <a href="http://public.kitware.com/cgi-bin/mailman/listinfo/community" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/community</a><br>
><br>
</blockquote></div><br></div>