[Insight-users] QT and cmake

Julien Jomier jjomier@cs.unc.edu
Fri May 21 00:53:15 EDT 2004


Hi Jayant,

CMake should automatically moc the .ui file when using the QT_WRAP_UI
command.
Can you try to replace the QT_WRAP_CPP statement by

IF(QT_WRAP_UI)
QT_WRAP_UI( segmentationGUI  segmentationGUI_HDRS segmentationGUI_SRCS
${segmentationGUI_GUI_SRCS})
ENDIF(QT_WRAP_UI)

Hope this helps,

Julien

----- Original Message ----- 
From: Jayant Chauhan
To: insight-users@itk.org
Sent: Thursday, May 20, 2004 7:00 PM
Subject: [Insight-users] QT and cmake


Guys,
The trolltech forum stinks. Its nowhere as cool as itks.
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).

I am getting these errors :

 Building Custom Rule D:\Jayant\MTP\segmentationGUI\CMakeLists.txt
Compiling...
segmentationGUI.cpp
mainGUI.cpp
Generating Code...
Linking...
segmentationGUI.obj : error LNK2001: unresolved external symbol "protected:
virtual void __thiscall mainForm::initMetaObject(void)"
(?initMetaObject@mainForm@@MAEXXZ)
segmentationGUI.obj : error LNK2001: unresolved external symbol "public:
virtual char const * __thiscall mainForm::className(void)const "
(?className@mainForm@@UBEPBDXZ)
segmentationGUI.obj : error LNK2001: unresolved external symbol "public:
static class QString  __cdecl mainForm::tr(char const *)"
(?tr@mainForm@@SA?AVQString@@PBD@Z)
segmentationGUI.obj : error LNK2001: unresolved external symbol "public:
static class QMetaObject * __cdecl mainForm::staticMetaObje ct(void)"
(?staticMetaObject@mainForm@@SAPAVQMetaObject@@XZ)
RelWithDebInfo/segmentationGUI.exe : fatal error LNK1120: 4 unresolved
externals
Error executing link.exe.


My CMakeLists.txt is as follows :

PROJECT(segmentationGUI)
INCLUDE (${CMAKE_ROOT}/Modules/FindQt.cmake)
INCLUDE_DIRECTORIES(
${QT_INCLUDE_PATH}
${QT_INCLUDE_DIR}
)

LINK_LIBRARIES(
 ${QT_QT_LIBRARY}
 ${QT_GL_LIBRARY}
 ${OPENGL_glu_LIBRARY}
 ${OPENGL_LIBRARY}
)
SET( segmentationGUI_SRCS
 segmentationGUI.cpp
 mainGUI.cpp
)
SET( segmentationGUI_MOC_SRCS
 segmentationGUI.h
)
SET(segmentationGUI_GUI_SRCS
  segmentationGUI.ui
)

IF(QT_WRAP_CPP)
 QT_WRAP_CPP( segmentationGUI ${segmentationGUI_SRCS}
${segmentationGUI_MOC_SRCS} )
ENDIF(QT_WRAP_CPP)
ADD_DEFINITIONS(-DQT_DLL)
ADD_DEFINITIONS(-DQT_THREAD_SUPPORT)
ADD_EXECUTABLE(segmentationGUI segmentationGUI_SRCS)

----------------------------------------------------------------------------
------------------------------------------------------

mainGUI.cpp just contains the main()


with regards
Jayant



Marriage? Join BharatMatrimony.com for free.
_______________________________________________ Insight-users mailing list
Insight-users@itk.org http://www.itk.org/mailman/listinfo/insight-users




More information about the Insight-users mailing list