[CMake] cmake + Qt4 compilation problem

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Tue Sep 9 02:26:34 EDT 2008


> Von: "Luis Roberto P. Paula"
> Hello everyone!
> 
> I'm trying to compile a simple application using Qt4 with cmake, but I'm
> stucked in this error:
> 
> [ 33%] Generating ui_mivgui.h
> Scanning dependencies of target viewer
> [ 66%] Building CXX object CMakeFiles/viewer.dir/main.o
> [100%] Building CXX object CMakeFiles/viewer.dir/mivgui.o
> Linking CXX executable viewer
> CMakeFiles/viewer.dir/mivgui.o: In function `MivGui::MivGui(QWidget*)':
> mivgui.cxx:(.text+0x14e): undefined reference to `vtable for MivGui'
> mivgui.cxx:(.text+0x158): undefined reference to `vtable for MivGui'
> CMakeFiles/viewer.dir/mivgui.o: In function `MivGui::MivGui(QWidget*)':
> mivgui.cxx:(.text+0x2c6): undefined reference to `vtable for MivGui'
> mivgui.cxx:(.text+0x2d0): undefined reference to `vtable for MivGui'
> CMakeFiles/viewer.dir/mivgui.o: In function `MivGui::tr(char const*, char
> const*)':
> mivgui.cxx:(.text._ZN6MivGui2trEPKcS1_[MivGui::tr(char const*, char
> const*)]+0x1e): undefined reference to `MivGui::staticMetaObject'
> collect2: ld returned 1 exit status
> make[2]: *** [viewer] Error 1
> make[1]: *** [CMakeFiles/viewer.dir/all] Error 2
> make: *** [all] Error 2
> 
<snip>
> 
> CMakeLists.txt
> ----------------------------------------------------------------------------------------------------------------------------------------------
> 
> SET(SOURCES_CPP
>  main.cxx
>  mivgui.cxx)
> MESSAGE( STATUS ${SOURCES_CPP} )
> 
> SET(SOURCES_H
>  mivgui.h)
> MESSAGE( STATUS ${SOURCES_H} )
> 
> SET(SOURCES_UI
>  mivgui.ui)
> MESSAGE( STATUS ${SOURCES_UI} )
> 
> FIND_PACKAGE(Qt4 REQUIRED)
> 
> include(${QT_USE_FILE})
> 
> QT4_WRAP_UI(SOURCES_UI_H ${SOURCES_UI})
> 
> #qt4_automoc(${SOURCES_H})
> 
Why did you comment out this line?
You need to moc your header - otherwise you'll get linker errors like above.


Christian
-- 
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/wasistshortview.php?mc=sv_ext_mf@gmx


More information about the CMake mailing list