[Insight-users] QT and cmake

Jayant Chauhan gripened@hotmail.com
Fri May 21 00:00:06 EDT 2004


<html><div style='background-color:'><DIV class=RTE>Guys,</DIV>
<DIV class=RTE>The trolltech forum stinks. Its nowhere as cool as itks.</DIV>
<DIV class=RTE>I have been able to compile and run QtITK and QtViewer applications. But am having trouble running a simple GUI built using QT (QT Designer first and then using the .h and .cpp files outputted by moc).</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>I am getting these errors :</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&nbsp;Building Custom Rule D:\Jayant\MTP\segmentationGUI\CMakeLists.txt<BR>Compiling...<BR>segmentationGUI.cpp<BR>mainGUI.cpp<BR>Generating Code...<BR>Linking...<BR>segmentationGUI.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall mainForm::initMetaObject(void)" (<A href="mailto:?initMetaObject@mainForm@@MAEXXZ">?initMetaObject@mainForm@@MAEXXZ</A>)<BR>segmentationGUI.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall mainForm::className(void)const " (<A href="mailto:?className@mainForm@@UBEPBDXZ">?className@mainForm@@UBEPBDXZ</A>)<BR>segmentationGUI.obj : error LNK2001: unresolved external symbol "public: static class QString&nbsp; __cdecl mainForm::tr(char const *)" (<A href="mailto:?tr@mainForm@@SA?AVQString@@PBD@Z">?tr@mainForm@@SA?AVQString@@PBD@Z</A>)<BR>segmentationGUI.obj : error LNK2001: unresolved external symbol "public: static class QMetaObject * __cdecl mainForm::staticMetaObject(void)" (<A href="mailto:?staticMetaObject@mainForm@@SAPAVQMetaObject@@XZ">?staticMetaObject@mainForm@@SAPAVQMetaObject@@XZ</A>)<BR>RelWithDebInfo/segmentationGUI.exe : fatal error LNK1120: 4 unresolved externals<BR>Error executing link.exe.</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>My CMakeLists.txt is as follows :</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>PROJECT(segmentationGUI)</DIV>
<DIV class=RTE>INCLUDE (${CMAKE_ROOT}/Modules/FindQt.cmake)</DIV>
<DIV class=RTE>INCLUDE_DIRECTORIES(<BR>${QT_INCLUDE_PATH}<BR>${QT_INCLUDE_DIR}<BR>)</DIV>
<DIV class=RTE><BR>LINK_LIBRARIES(<BR>&nbsp;${QT_QT_LIBRARY}<BR>&nbsp;${QT_GL_LIBRARY}<BR>&nbsp;${OPENGL_glu_LIBRARY}<BR>&nbsp;${OPENGL_LIBRARY}</DIV>
<DIV class=RTE>)</DIV>
<DIV class=RTE>SET( segmentationGUI_SRCS <BR>&nbsp;segmentationGUI.cpp <BR>&nbsp;mainGUI.cpp <BR>)</DIV>
<DIV class=RTE>SET( segmentationGUI_MOC_SRCS <BR>&nbsp;segmentationGUI.h <BR>)</DIV>
<DIV class=RTE>SET(segmentationGUI_GUI_SRCS <BR>&nbsp; segmentationGUI.ui<BR>)</DIV>
<DIV class=RTE><BR>IF(QT_WRAP_CPP)<BR>&nbsp;QT_WRAP_CPP( segmentationGUI ${segmentationGUI_SRCS} ${segmentationGUI_MOC_SRCS} )<BR>ENDIF(QT_WRAP_CPP)</DIV>
<DIV class=RTE>ADD_DEFINITIONS(-DQT_DLL)</DIV>
<DIV class=RTE>ADD_DEFINITIONS(-DQT_THREAD_SUPPORT)</DIV>
<DIV class=RTE>ADD_EXECUTABLE(segmentationGUI segmentationGUI_SRCS)<BR></DIV>
<DIV class=RTE>----------------------------------------------------------------------------------------------------------------------------------</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>mainGUI.cpp just contains the main()</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>with regards</DIV>
<DIV class=RTE>Jayant</DIV></div><br clear=all><hr>Marriage? <a href="http://g.msn.com/8HMBENIN/2740??PS=47575">Join BharatMatrimony.com for free.</a> </html>



More information about the Insight-users mailing list