Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to link against the QTTest
Forum Updated to NodeBB v4.3 + New Features

How to link against the QTTest

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 890 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rtam
    wrote on last edited by rtam
    #1

    Hi,

    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

    QUICK_TEST_MAIN(example)
    

    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!

    Cheers,
    Tamas

    1 Reply Last reply
    0
    • R Offline
      R Offline
      rtam
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        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.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved