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