Linker error with testlib project
-
wrote on 21 Mar 2011, 19:57 last edited by
Hello,
I have been using Qt Creator as a Qt and general purpose IDE for the past few weeks. My desktop and Wt applications are running fine. I am now in the process of creating a core library project with associated unit test suite (my first attempt at using the testlib framework). I created the project based upon http://qtcreator.blogspot.com/2010/04/sample-multiple-unit-test-project.html.
@
QT += testlib
QT -= guiCONFIG += console
CONFIG -= app_bundleTARGET = UnitTest
TEMPLATE = appINCLUDEPATH +=
/opt/local/include
/opt/local/include/mongo
src testLIBS +=
-lssl -lcryptoSOURCES +=
src/util/Encrypter.cpp
test/main.cpp
test/util/EncrypterTestSuite.cppHEADERS +=
src/util/Encrypter.h
test/AutoTest.h
test/util/EncrypterTestSuite.h
@The code builds fine, however linking fails with the following error:
@g++ -headerpad_max_install_names -o UnitTest Encrypter.o main.o EncrypterTestSuite.o moc_EncrypterTestSuite.o -F/Library/Frameworks -L/Library/Frameworks -lssl -lcrypto -framework QtTest -L/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib -F/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib -framework IOKit -framework ApplicationServices -framework Security -framework QtCore
ld: warning: directory not found for option '-L/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib'
ld: warning: directory not found for option '-F/tmp/qt-stuff-6474/source/qt-everywhere-opensource-src-4.7.0/lib'
Undefined symbols for architecture x86_64:
"EncrypterTestSuite::initTestCase()", referenced from:
EncrypterTestSuite::qt_metacall(QMetaObject::Call, int, void**)in moc_EncrypterTestSuite.o
"EncrypterTestSuite::testAes()", referenced from:
EncrypterTestSuite::qt_metacall(QMetaObject::Call, int, void**)in moc_EncrypterTestSuite.o
"EncrypterTestSuite::testDes()", referenced from:
EncrypterTestSuite::qt_metacall(QMetaObject::Call, int, void**)in moc_EncrypterTestSuite.o
"EncrypterTestSuite::cleanupTestCase()", referenced from:
EncrypterTestSuite::qt_metacall(QMetaObject::Call, int, void**)in moc_EncrypterTestSuite.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [UnitTest] Error 1
make: Leaving directory `/Users/rakesh/svn/cpp/coretest-build-desktop'
The process "/usr/bin/make" exited with code %2.
Error while building project coretest (target: Desktop)
When executing build step 'Make'@The build directory contains all the .o files, so I am not sure what is wrong. Just running the test project downloaded from above mentioned link does work fine. Any idea what I might be missing in my project configuration?
Thanks in advance for all help.
Rakesh -
wrote on 21 Mar 2011, 20:13 last edited by
Never mind, classic case of me spotting the problem a few seconds after posting the issue. Auto complete seems to have messed up the class name in the test class implementation file. Sorry for wasting bandwidth.
1/2