Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to link against the QTTest
rtam last edited by rtam
I have some linking problems when using QTTest framework
I want to make a QML test and I use the QTTest framework with QTCreator. In the QML file I have the "import QtTest 1.1" statement, and the IDE recognizes the "TestCase" element, so it shall be fine.
I set the main.cpp function as it was written in the tutorial
The problem is: it does not find the method in any of the linked libraries.
main.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) int __cdecl quick_test_main(int,char * *,char const ,char const *)" (__imp_?quick_test_main@@YAHHPEAPEADPEBD1@Z) referenced in function main
my .pro file looks like, so I guess this symbol shall be in the "testllib" somewhere. In the documentation I did not find anything that would point to the right library to use. The only info I found was this tutorial (http://doc.qt.io/qt-5/qttestlib-tutorial2-tutorial2-pro.html) and it uses the "testlib"
QT += qml quick testlib SOURCES += main.cpp \ processor.cpp RESOURCES += qml.qrc QML_IMPORT_PATH = include(deployment.pri) HEADERS += \ processor.h TARGET = tst_example CONFIG += warn_on qmltestcase
Does anyone has an idea how to link it correctly? Thank you!
rtam last edited by
Someone told me the answer: I had to run "Build/Run qmake". After that it works ok.
I wonder why I need that? What does that mean? Will it reconfigure my make files?
Hi and welcome to devnet,
It's because you modified your pro file. Running qmake after that will refresh the Makefiles with the needed content to build your project correctly.