[Insight-users] Qt with Cmake linking problem
Nicolas
itk at fete.ch
Wed Mar 7 07:24:17 EST 2007
Hello everybody,
I'm actually trying to compile a QT application using a .ui with Cmake.
The application works using qmake but I have to use CMake beause I'm using
ITK too.
I still have problems with the linking phase (error listed below).
Does anyone have an idea what is missing in my CmakeLists.txt ?
Thanks a lot in advance ! nico
___________________________________________
PROJECT(browserPileImagesStandalone)
cmake_minimum_required(VERSION 2.4.0)
#IF( BUILD_OUTSIDE_INSIGHT_APPLICATIONS )
FIND_PACKAGE(ITK REQUIRED)
IF(ITK_FOUND)
INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
MESSAGE(FATAL_ERROR
"Cannot build InsightApplications without ITK. Please set
ITK_DIR.")
ENDIF(ITK_FOUND)
#ENDIF( BUILD_OUTSIDE_INSIGHT_APPLICATIONS )
SET(SOURCES_CPP
../code/main.cpp
../code/browserPileImages.cpp)
MESSAGE( STATUS ${SOURCES_CPP} )
SET(SOURCES_H
../code/browserPileImages.h)
MESSAGE( STATUS ${SOURCES_H} )
SET(SOURCES_UI
../code/browserPileImages.ui)
MESSAGE( STATUS ${SOURCES_UI} )
# Find QT4
# attention a la casse de Qt4 !!
FIND_PACKAGE(Qt4 REQUIRED)
include(${QT_USE_FILE})
# execute uic sur les fichier .ui -> generation des .h associes
# ne pas oublier de rajouter les .h generes a add_exectuable
QT4_WRAP_UI(SOURCES_UI_H ${SOURCES_UI})
# pour la macro Q_OBJECT..
qt4_automoc(${SOURCES_H})
# pour trouver le ui_h
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )
ADD_EXECUTABLE(browserPileImagesStandalone ${SOURCES_CPP} ${SOURCES_H}
${SOURCES_UI_H})
TARGET_LINK_LIBRARIES(browserPileImagesStandalone ${QT_LIBRARIES} )
___________________________________________
browserPileImages.obj : error LNK2019: unresolved external symbol "public:
static struct QMetaObject const BrowserPileImages::staticMetaObject"
(?staticMetaObject at BrowserPileImages@@2UQMetaObject@@B) referenced in
function "public: static class QString __cdecl BrowserPileImages::tr(char
const *,char const *)" (?tr at BrowserPileImages@@SA?AVQString@@PEBD0 at Z)
1>browserPileImages.obj : error LNK2001: unresolved external symbol "public:
virtual struct QMetaObject const * __cdecl
BrowserPileImages::metaObject(void)const "
(?metaObject at BrowserPileImages@@UEBAPEBUQMetaObject@@XZ)
1>browserPileImages.obj : error LNK2001: unresolved external symbol "public:
virtual void * __cdecl BrowserPileImages::qt_metacast(char const *)"
(?qt_metacast at BrowserPileImages@@UEAAPEAXPEBD at Z)
1>browserPileImages.obj : error LNK2001: unresolved external symbol "public:
virtual int __cdecl BrowserPileImages::qt_metacall(enum
QMetaObject::Call,int,void * *)"
(?qt_metacall at BrowserPileImages@@UEAAHW4Call at QMetaObject@@HPEAPEAX at Z)
1>Release\browserPileImagesStandalone.exe : fatal error LNK1120: 4
unresolved externals
--
Nicolas FETE, PhD student biotech
EPFL Computer Science Engineer
Ecole Polytechnique Federale de Lausanne
Faculte des Sciences de la Vie
Laboratoire de Dynamique des Cellules Souches
Batiment AAB
Station 15
CH-1015 Lausanne
Tel:+41 21 693 16 33
Fax:+41 21 693 16 30
HomePage (under construction): http://ldcs.epfl.ch
More information about the Insight-users
mailing list