[CMake] CMake and Qt3

olivier.stern at swing.be olivier.stern at swing.be
Tue Jul 19 10:28:20 EDT 2005


One error was that I was using gcc 2.96. Now it s 3.4.1. But I still have lots of error about function and variable not declared. Where should I verify if the includes are right ? (I ve begun with Qt yesterday in fact... I need a user interface with a library using cmake to compile...). My ui.h file has been rename by myself .h because there was an error when compiling. Otherwise, I have a main.cpp file, essai.ui file and essai.ui.h file.

Olivier


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

You shouldn't have to modify any files coming out of the Qt Designer.   
You may have to make sure that you have the correct includes in either  
the ui.h files or that they get added into the widget by the designer.   
Note that adding them into the designer gives better dependency  
tracking in CMake.

       Karl

On Jul 19, 2005, at 6:43 AM, olivier.stern at swing.be wrote:

> Thanks a lot for all your answers,
>
> This way seems to be working and I think now that if it doesn't  
> correctly compile it's because I'm using files made by Qt Designer.  
> Seems like there're modifications to do, I don't really know what for  
> the moment, but I'll try to correct it.
>
> Olivier
>
>
> ----------------------------------------
> FIND_PACKAGE(Qt)
>
> ADD_DEFINITIONS(${QT_DEFINITIONS})
> INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
>
> QT_WRAP_CPP(qtwrapping moc_sources essai.h)
> QT_WRAP_UI(qtwrapping headers sources essai.ui)
> ADD_EXECUTABLE(qtwrapping main.cpp ${moc_sources} ${headers}  
> ${sources})
> TARGET_LINK_LIBRARIRES(qtwrapping ${QT_LIBRARIES})
>
> That should do it
>
> On Monday 18 July 2005 23:59, Olivier Stern wrote:
> > 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  
> tryi!  ng
> > 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+0x
> >1
> >
> > 6): In function `essai::findFile(void)':
> > : undefined reference to `QString::null'
> >
> >  
> /home/olivier/Tfe/GDCM/gdcmBin/bin/Tfe/TEST2/ 
> libmyqtlib.a(essai.o)(.text+0x
> >1
> >
> > f): In function `essai::findFile(void)':
> > : undefined reference to `QString::null'
> >
> >  
> /home/olivier/Tfe/GDCM/gdcmBin/bin/Tfe/TEST2/ 
> libmyqtlib.a(essai.o)(.text+0x
> >2
> >
> > 4): In function `essai::findFile(void)':
> > : undefined reference to `QString::null'
> >
> >  
> /home/olivier/Tfe/GDCM/gdcmBin/bin/Tfe/TEST2/ 
> libmyqtlib.a(essai.o)(.text+0x
> >2
> >
> > 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+0x
> >b
> >
> > d): In function `essai::findDir1(void)':
> > : undefined reference to `QString::null'
> >
> > Thank you for your help,
> >
> >
> >
> > Olivier
>
> -- 
> Filipe Sousa
>
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20050719/351fac6e/attachment.htm


More information about the CMake mailing list