[CMake] CMake and Qt3

Olivier Stern olivier.stern at swing.be
Mon Jul 18 18:59:14 EDT 2005


Hello every one,

 

I'm trying to make a CMakeLists.txt file which create a makefile for an
application using Qt3. I've seen different posts about it and after trying
everything I come here to ask some help. Here what is done : a simple qt
application which include 3 files (essai.h essai.ui and main.cpp) and this
CMakeLists.txt based on the wrapping test :

 

SET (QT_WRAP_CPP "On")

SET (QT_MOC_EXE "echo")

 

INCLUDE( ${CMAKE_ROOT}/Modules/FindQt.cmake )

 

INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} )

INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )

 

SET (QT_WRAP_UI "On")

SET (QT_UIC_EXE "${QT_UIC_EXECUTABLE}")

 

SET (QTUI_SRCS

  essai.ui

  )

QT_WRAP_UI (myqtlib QTUI_H_SRCS QTUI_S_SRCS ${QTUI_SRCS})

QT_WRAP_CPP (myqtlib QT_MOC_SRCS ${SRCS} essai.h)

 

MESSAGE("QT files are ${QTUI_S_SRCS}")

MESSAGE("QT other files are ${QTUI_H_SRCS}")

ADD_DEFINITIONS(${QT_DEFINITIONS})

ADD_LIBRARY(myqtlib ${QTUI_S_SRCS} ${QT_MOC_SRCS})

ADD_EXECUTABLE (qtwrapping main.cpp)

TARGET_LINK_LIBRARIES(qtwrapping myqtlib)

TARGET_LINK_LIBRARIES( qtwrapping ${QT_LIBRARIES} )

 

After creating the makefile and compiling the program I have lots of errors
but all the same type : undefined reference to 

 

For example the first lines are :

 

main.o(.text+0x17): In function `main':

: undefined reference to `QApplication::QApplication(int &, char **)'

main.o(.text+0x80): In function `main':

: undefined reference to `QApplication::setMainWidget(QWidget *)'

main.o(.text+0xa7): In function `main':

: undefined reference to `QApplication::exec(void)'

main.o(.text+0xbb): In function `main':

: undefined reference to `QApplication::~QApplication(void)'

main.o(.text+0xf2): In function `main':

: undefined reference to `QApplication::~QApplication(void)'

/home/olivier/Tfe/GDCM/gdcmBin/bin/Tfe/TEST2/libmyqtlib.a(essai.o)(.text+0x1
6): In function `essai::findFile(void)':

: undefined reference to `QString::null'

/home/olivier/Tfe/GDCM/gdcmBin/bin/Tfe/TEST2/libmyqtlib.a(essai.o)(.text+0x1
f): In function `essai::findFile(void)':

: undefined reference to `QString::null'

/home/olivier/Tfe/GDCM/gdcmBin/bin/Tfe/TEST2/libmyqtlib.a(essai.o)(.text+0x2
4): In function `essai::findFile(void)':

: undefined reference to `QString::null'

/home/olivier/Tfe/GDCM/gdcmBin/bin/Tfe/TEST2/libmyqtlib.a(essai.o)(.text+0x2
a): In function `essai::findFile(void)':

: undefined reference to `QFileDialog::getOpenFileName(QString const &,
QString const &, QWidget *, char const *, QString const &, QString *, bool)'

/home/olivier/Tfe/GDCM/gdcmBin/bin/Tfe/TEST2/libmyqtlib.a(essai.o)(.text+0xb
d): In function `essai::findDir1(void)':

: undefined reference to `QString::null'

 

Thank you for your help,

 

            Olivier

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20050719/8058eb2f/attachment.html


More information about the CMake mailing list