Linker error with testlib project
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 -= gui
- CONFIG += console
- CONFIG -= app_bundle
- TARGET = UnitTest
- TEMPLATE = app
- INCLUDEPATH += \
- /opt/local/include \
- /opt/local/include/mongo \
- src test
- LIBS += \
- -lssl -lcrypto
- SOURCES += \
- src/util/Encrypter.cpp \
- test/main.cpp \
- HEADERS += \
- src/util/Encrypter.h \
- test/AutoTest.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::testAes()", referenced from:
- "EncrypterTestSuite::testDes()", referenced from:
- "EncrypterTestSuite::cleanupTestCase()", referenced from:
- 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.