Qt World Summit: Register Today!

[SOLVED] Qt Creator and CMake on Windows

  • I am trying to move away from Microsoft Visual Studio on Widnows.

    I have installed the binaries Qt 5.3.2 for Windows 32-bit (MinGW 4.8.2, OpenGL) directly from http://qt-project.org/downloads and I have a simple CMakeLists.txt

    add_executable(Test test.cpp )
    qt5_use_modules(Test Widgets)
    It works when I use CMake through the Visual Studio Generator and it also works on Linux.


    • I open the CMake Project using QtCreator
    • I use CMakeGui to set the variable Qt5Widgets_DIR = "C:\Qt\Qt5.3.2\5.3\mingw482_32\lib\cmake/Qt5Widgets"
    • I set Core and GUI accordingly
    • Then QtCreator successfully configures and generates its makefiles.

    My source code compiles but I get linkage errors
    @undefined reference to `_imp___ZN12QApplicationC1ERiPPci'

    and a couple similar ones.

    It would be very helpful if somebody could point out what I am doing wrong in this simplistic set up.

    Trouble is, I can't even see the compiler call in the "4 Compile Output" tab, which is annoying to begin with. NOW: How can I check EXACTLY which libraries are being linked. The makefiles are really hard to read...

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Did you check the "Qt Creator's manual":http://qt-project.org/doc/qt-5/cmake-manual.html for qmake

    Hope it helps

  • Really, nobody any suggestions?

    I guess I'm just not gonna use QtCreator, if a simple linker problem is unsolvable.

  • SOOOO I got it.

    I had
    set to

    I simply deleted that environment variable and now it works.

    I don't think this is intended behavior. It should be possible to set all variables in CMake and override whatever is in CMAKE_PREFIX_PATH.

    My problem that I don't see what exactly the makefile is doing. SO far I do not like QtCreator.

Log in to reply