I write 2 files teststring.h and teststring.cpp below *teststring.h* #ifndef TESTSTRING_H #define TESTSTRING_H #include <QtTest/QTest> class TestString : public QObject { Q_OBJECT private slots: void toUpper(); }; QTEST_MAIN(TestString); #endif *teststring.cpp* #include "teststring.h" void TestString::toUpper() { QString str = "Hello"; QVERIFY(str.toUpper() == "HELLO"); } *CMakeLists.txt* find_package(Qt4 REQUIRED) include(${QT_USE_FILE}) add_executable(mytest teststring.h teststring.cpp) target_link_libraries(mytest ${QT_LIBRARIES}) but when build, errors of linking appear Error 1 error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall TestString::metaObject(void)const " (?metaObject@TestString@@UBEPBUQMetaObject@@XZ) teststring.obj mytest ...... help me fix this bug. thank in advance!
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest