Hey @all,

i'm trying to compile a simple QtTestLib app, which ends up in a "undefined reference to vtable..." error.

Here is the simple source:
Qt Code:
  1. #include <QtTest>
  2.  
  3. class TestDemo: public QObject {
  4. Q_OBJECT
  5.  
  6. private slots:
  7. void initTestCase();
  8. void cleanupTestCase();
  9. void firstTest();
  10.  
  11. };
  12.  
  13. void TestDemo::initTestCase() {
  14. }
  15.  
  16. void TestDemo::cleanupTestCase() {
  17. }
  18.  
  19. void TestDemo::firstTest() {
  20. QVERIFY(1 == 1);
  21. }
  22.  
  23. QTEST_MAIN(TestDemo)
To copy to clipboard, switch view to plain text mode 

And here is the corresponding CMakeLists.txt file:
Qt Code:
  1. SET(QT_USE_QTMAIN TRUE)
  2. SET(QT_USE_QTTEST TRUE)
  3.  
  4. INCLUDE(${QT_USE_FILE})
  5. INCLUDE_DIRECTORIES(./)
  6.  
  7. SET(TESTDEMO_SOURCES
  8. main.cpp
  9. )
  10.  
  11. QT4_AUTOMOC(${TESTDEMO_SOURCES})
  12. ADD_EXECUTABLE(TestDemo ${TESTDEMO_SOURCES} ${TESTDEMO_MOC})
  13. TARGET_LINK_LIBRARIES(TestDemo ${QT_LIBRARIES})
To copy to clipboard, switch view to plain text mode 

The error I get is the following:
Qt Code:
  1. -- Configuring done
  2. -- Generating done
  3. -- Build files have been written to: build/Debug
  4. Scanning dependencies of target TestDemo
  5. [100%] Building CXX object test/TestDemo/CMakeFiles/TestDemo.dir/main.cpp.obj
  6. Linking CXX executable ..\..\bin\TestDemo.exe
  7. CMakeFiles\TestDemo.dir\main.cpp.obj: In function `TestDemo':
  8. test/TestDemo/main.cpp:4: undefined reference to `vtable for TestDemo'
  9. CMakeFiles\TestDemo.dir\main.cpp.obj: In function `~TestDemo':
  10. test/TestDemo/main.cpp:4: undefined reference to `vtable for TestDemo'
  11. collect2: ld returned 1 exit status
  12. mingw32-make[3]: *** [bin/TestDemo.exe] Error 1
  13. mingw32-make[2]: *** [test/TestDemo/CMakeFiles/TestDemo.dir/all] Error 2
  14. mingw32-make[1]: *** [test/TestDemo/CMakeFiles/TestDemo.dir/rule] Error 2
  15. mingw32-make: *** [TestDemo] Error 2
To copy to clipboard, switch view to plain text mode 

Could anybody help me to fix the problem?

Thanks in advance

Best Regards
NoRulez