Results 1 to 4 of 4

Thread: SOLVED: CMake link errors (A.K.A .moc handling)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Posts
    107
    Thanks
    36
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question SOLVED: CMake link errors (A.K.A .moc handling)

    Hi guys!
    I'm back after a long time just to "bug" you with my problems with migration from qmake to cmake (namely from Kdev3 to Kdev4) ...

    This is my CMakeLists.txt :

    Qt Code:
    1. project(teltonika_tcp_server3_garmin_support)
    2. cmake_minimum_required(VERSION 2.6)
    3. find_package(Qt4 REQUIRED)
    4.  
    5. include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
    6.  
    7. set(teltonika_tcp_server3_garmin_support_SRCS crc_utils.cpp garmin_utils.cpp main.cpp server.cpp teltonikaunit.cpp)
    8. set(teltonika_tcp_server3_garmin_support_MOC_HDRS crc16.h crc_utils.h garmin.h garmin_utils.h properties.h server.h teltonikaunit.h)
    9.  
    10. add_definitions(-DQT_THREAD_SUPPORT)
    11.  
    12. qt4_wrap_cpp(teltonika_tcp_server3_garmin_support ${teltonika_tcp_server3_garmin_support_MOC_HDRS})
    13.  
    14. #qt4_automoc(${teltonika_tcp_server3_garmin_support_SRCS})
    15.  
    16. add_executable(teltonika_tcp_server3_garmin_support ${teltonika_tcp_server3_garmin_support_SRCS})
    17. target_link_libraries(teltonika_tcp_server3_garmin_support ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QT_QTSQL_LIBRARY})
    To copy to clipboard, switch view to plain text mode 

    On the linker phase I get this:

    Qt Code:
    1. CMakeFiles/teltonika_tcp_server3_garmin_support.dir/main.cpp.o: In function `main':
    2. main.cpp:(.text+0x741): undefined reference to `vtable for Server'
    3. main.cpp:(.text+0x922): undefined reference to `vtable for Server'
    4. CMakeFiles/teltonika_tcp_server3_garmin_support.dir/server.cpp.o: In function `Server::Server(QObject*)':
    5. server.cpp:(.text+0xab): undefined reference to `vtable for Server'
    6. CMakeFiles/teltonika_tcp_server3_garmin_support.dir/teltonikaunit.cpp.o: In function `TeltonikaThread::TeltonikaThread(int)':
    7. teltonikaunit.cpp:(.text+0x9f4): undefined reference to `vtable for TeltonikaThread'
    8. CMakeFiles/teltonika_tcp_server3_garmin_support.dir/teltonikaunit.cpp.o: In function `TeltonikaUnit::~TeltonikaUnit()':
    9. teltonikaunit.cpp:(.text+0xb2f8): undefined reference to `vtable for TeltonikaUnit'
    10. CMakeFiles/teltonika_tcp_server3_garmin_support.dir/teltonikaunit.cpp.o: In function `TeltonikaUnit::TeltonikaUnit(int)':
    11. teltonikaunit.cpp:(.text+0xdd97): undefined reference to `vtable for TeltonikaUnit'
    12. teltonikaunit.cpp:(.text+0xde2a): undefined reference to `TeltonikaUnit::error(QAbstractSocket::SocketError)'
    13. CMakeFiles/teltonika_tcp_server3_garmin_support.dir/teltonikaunit.cpp.o: In function `TeltonikaUnit::disconnected()':
    14. teltonikaunit.cpp:(.text+0x9c8): undefined reference to `TeltonikaUnit::quit()'
    15. CMakeFiles/teltonika_tcp_server3_garmin_support.dir/teltonikaunit.cpp.o: In function `TeltonikaUnit::forceDisconnect()':
    16. teltonikaunit.cpp:(.text+0xa95): undefined reference to `TeltonikaUnit::quit()'
    17. CMakeFiles/teltonika_tcp_server3_garmin_support.dir/teltonikaunit.cpp.o: In function `TeltonikaUnit::checkConnection()':
    18. teltonikaunit.cpp:(.text+0x14a00): undefined reference to `TeltonikaUnit::quit()'
    19. collect2: ld returned 1 exit status
    To copy to clipboard, switch view to plain text mode 

    Searching the project's tree I see that no .moc files are being created!
    I assumed that this line
    Qt Code:
    1. qt4_wrap_cpp(teltonika_tcp_server3_garmin_support ${teltonika_tcp_server3_garmin_support_MOC_HDRS})
    To copy to clipboard, switch view to plain text mode 

    would take care of business (as per much googling...)

    I'm lost here and would really appreciate any help

    Best regards,
    Pedro Doria Meunier
    Last edited by pdoria; 6th June 2010 at 16:28. Reason: SOLVED

Similar Threads

  1. Static Qt+Webkit 4.6.2 Link Errors
    By geekox86 in forum Installation and Deployment
    Replies: 3
    Last Post: 20th June 2010, 05:06
  2. QCreator - undefined reference link errors
    By stodge in forum Newbie
    Replies: 2
    Last Post: 5th April 2009, 14:07
  3. Link errors for plugin under windows
    By QPlace in forum Qt Programming
    Replies: 5
    Last Post: 2nd November 2008, 15:51
  4. Q_OBJECT macro and link errors
    By pscheven in forum Qt Programming
    Replies: 4
    Last Post: 21st March 2008, 13:23
  5. Link Errors
    By magikalpnoi in forum Qt Programming
    Replies: 5
    Last Post: 25th September 2006, 22:04

Tags for this Thread

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.