Results 1 to 5 of 5

Thread: build project with cmake does not work

  1. #1
    Join Date
    Apr 2007
    Posts
    76
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default build project with cmake does not work

    Hello!

    I'm learning cmake and i run into a problem.
    the code that I compiled with qmake/make from a .pro file it builds OK.

    So I've wrote a CMakeLists.txt like on the wiki and made some changes.

    cmake process execute with no errors, but make returns me this:
    Linking CXX executable test.x
    CMakeFiles/test.x.dir/bgPannel.cpp.o: In function `BGPannel::BGPannel(QWidget*, char const*)':
    bgPannel.cpp.text+0x15d): undefined reference to `vtable for BGPannel'
    bgPannel.cpp.text+0x16c): undefined reference to `vtable for BGPannel'
    CMakeFiles/test.x.dir/bgPannel.cpp.o: In function `BGPannel::BGPannel(QWidget*, char const*)':
    bgPannel.cpp.text+0x4d9): undefined reference to `vtable for BGPannel'
    bgPannel.cpp.text+0x4e8): undefined reference to `vtable for BGPannel'
    collect2: ld returned 1 exit status
    make[2]: *** [test.x] Error 1
    make[1]: *** [CMakeFiles/test.x.dir/all] Error 2
    make: *** [all] Error 2
    any clue?
    as I understand the problem should be in finding .h file, but don't know how to implement it in CMakeLists.txt
    the CMakeLists.txt and .pro are attached.
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: build project with cmake does not work

    Quote Originally Posted by codebehind View Post
    add_executable( test.x ${${PACKAGE}_SRCS} ${${PACKAGE}_MOC_HDRS} ${${PACKAGE}_HDRS} )
    Shouldn't you use ${PACKAGE}_MOC_LIBS here instead of ..._HDRS?

  3. #3
    Join Date
    Apr 2007
    Posts
    76
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: build project with cmake does not work

    i have done that. cmake returns this:
    -- Configuring done
    CMake Error in CMakeLists.txt:
    Cannot find source file "moc_bgPannel.o". Tried extensions .c .C .c++ .cc
    .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx
    and my knowledge ends here

  4. #4
    Join Date
    Apr 2007
    Posts
    76
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: build project with cmake does not work

    Is there a chance that the problem is making qmake?
    cmake uses qmake by default. But my qmake points to qmake of qt4.
    if so is there a variable to set which version of qmake should cmake use?

  5. #5
    Join Date
    Apr 2007
    Posts
    76
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: build project with cmake does not work

    Finally I've done it.

    the problem was at:
    Qt Code:
    1. add_executable( test.x ${${PACKAGE}_SRCS} .moc/moc_bgPannel.cpp)
    To copy to clipboard, switch view to plain text mode 

    i forgot the hidden directory .moc!!!

Similar Threads

  1. qmake -project does not work
    By Caius Aérobus in forum Installation and Deployment
    Replies: 2
    Last Post: 7th February 2008, 17:55
  2. Set up the Qt4.3.2 with Visual Studio 2005
    By lamoda in forum Installation and Deployment
    Replies: 6
    Last Post: 30th January 2008, 06:51
  3. Replies: 2
    Last Post: 8th November 2007, 20:15
  4. Build error on mac Platform::WaitMouseMoved
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 12th July 2007, 13:18
  5. CMake and pthreads
    By Matt Smith in forum General Discussion
    Replies: 5
    Last Post: 3rd September 2006, 20:42

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.