Important: Please read the Qt Code of Conduct -

[Solved] Problem with CMake and QT 5 dlls in Windows

  • I am creating a CMake file for compiling a simple hello world program that uses QtCore. I use CMake to generate a VS 2012 project and it compiles fine. But when I execute it, it gives an error that says that Qt5Core.dll is missing.

    I can fix this copying the .dll manually into the executable's directory, but I don't like this solution. Here is my CMake file:

    set (CMAKE_PREFIX_PATH "C:\qt_src\qt5-2010\qtbase\")


    add_executable(toview ${SOURCE})
    qt5_use_modules(toview Core)@

    Am I missing something? Is there a better way to do this? Thanks in advance!

  • Did you check your Qt environment path ?

  • I compiled QT myself, in my environment I only created QTDIR=C:\qt_src\qt5-2010\qtbase.

    Am I missing something? Do I need to add the bin path to PATH?

  • Yes you need to put not only the bin, but also the lib path

  • Ok, thanks a lot. Problem solved.

Log in to reply