How to run Qt 5 applications on other computers (Windows 7)

21,178

Solution 1

This the list of dlls I needed and also I have copied the C:\Qt\Qt5.0.2\5.0.2\mingw47_32\plugins\platforms folder:

enter image description here

Just this and it worked for me. BTW I use Windows 7 Ultimate 64x, and Qt 5.0.2 for Windows 32-bit (MinGW 4.7, 650 MB) package for Qt.

EDIT: You might also need QtCreator's .dll to be copied and also you might need to have a file named qt.conf with the following content (copied from @Renato answer):

[Paths]

Libraries=./platforms

Solution 2

just add the file qt.conf to your app dir with the following content

[Paths]

Libraries=./platforms

then copy, to same app dir, the subdir "platforms" that you will find into dir C:\Qt\Qt5.1.1\Tools\QtCreator\bin

That's all.

This solves because qtcore.dll is compiled with internal paths of your qt instalation. (I dont know wy !). Since, qt.conf is allways read by qtcore when the app starts the librarys in "platforms" will be included and the app works at all on anyone host.

Warning: the qtcore and platforms sub dir have to became from the same qt instalation.

Sorry by the English but the solution works fine.

Solution 3

Qt these days (as of at least Qt 5.2, if not earlier) ships with "windeployqt.exe", which when pointed at your compiled program (and, if like me you're using them, as an additional argument of "--qmldir path/to/QML/files" for a Qt Quick program) should spit out all the required DLLs into the same directory as your compiled program currently resides. So for myself on a local build machine for example, I ran something along the lines of:

    windeployqt --qmldir C:\Code\AppSource C:\Code\build-msvc2010\release

This is with the Qt \bin directory in my $PATH (or, I guess in Windows parlance, %PATH% ;)) using Qt 5.5, although I've done the same back with 5.2 and 5.3 as well.

IIRC if using MSVC as the compiler I still needed to copy those DLLs (in my case, msvc2010, so msvcp100.dll and msvcr100.dll) manually, but I could be remembering wrong.

Share:
21,178
Narek
Author by

Narek

Game developer.

Updated on July 05, 2022

Comments

  • Narek
    Narek almost 2 years

    I have developed a simple application with Qt 5.0.2 on Windows 7 Ultimate. As a compiler the QtCreator used MSVC2012_64bit. And I cannot move my application onto other computer. It does not work. Qt application requires DLLs that I can't find. The dependency explorer thinks that the .dlls below are not found. Where I can find them? Why is this problem so wide spreaded? All the people complain that they can not get their .exe, which is developed with Qt, work on other computer . enter image description here

    EDIT1: BTW when I have added DCOMP.dll downloaded from the internet, the not found dlls become 2-3 times more than it is now :)

    EDIT2: Also note that on other computer (Windows 7 Home Premium) when I double click on the exe file, it shows that it loades and no effect, no error nothing at all.

  • Erowlin
    Erowlin about 10 years
    You saved my night, thank you. Please, accept a bear some day.
  • jp36
    jp36 over 8 years
    windeployqt should create a vcredist_x86.exe in your output folder which can be run on the target system. This is the preferred way to handle missing msvc100.dll files and such (as in it is frowned upon to copy those manually). ---- Also, if you want a cleaner set of code to move to the new system you can move the yourapp.exe file to a new folder by itself and run windeployqt on it there which should bring in just the files you actually need on another computer
  • SuB
    SuB over 7 years
    Using MVC++ 2015, windeployqt does not make vcredist_x86.exe or vcredist_x64.exe file!