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

4

12

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.

Parthenogenesis answered 24/4, 2013 at 17:37 Comment(8)
So it's working on your computer? Why don't you use Process Explorer to get a list of all the DLLs that are loaded on during runtime?Dance
Yes sure! But I can't start the exe on other computers. And I can not find these dll anywhere in my computer. So strange.Parthenogenesis
Why don't you use Process Explorer to get a list of all the DLLs that are loaded during runtime? Like, when you start your program on your computer, where it's working, presumably. I mean, install Process Explorer on your computer, and do that. Also, didn't MSVC print out all the libraries loaded, like those messages 'rundll32.exe': Loaded 'C:\Windows\System32\dwmapi.dll', Cannot find or open the PDB fileDance
I have installed process explorer. How it helps to see what dlls and from where it loads?Parthenogenesis
Ok, OK I have found. Ctrl+D. But those dlls are about 50 :(Parthenogenesis
I think depends.exe always lists some bogus DLLs that it claims missing, but that aren't actually needed. Start with the Qt DLLs, other libs you explicitly added and the MSVC runtime.Faltboat
pdb files are not needed (used to help debugging by providing symbols) so you can ignore those warnings.Brassy
Is that other computer a 64bit Windows computer? The missing DLLs look like standard windows stuff. Your 64bit exe can't run on a 32bit computer.Nautch
P
10

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
Parthenogenesis answered 24/4, 2013 at 20:58 Comment(0)
P
8

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.

Plastid answered 8/9, 2013 at 13:35 Comment(1)
You saved my night, thank you. Please, accept a bear some day.Escobedo
C
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.

Charade answered 23/9, 2015 at 1:17 Comment(2)
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 computerWillwilla
Using MVC++ 2015, windeployqt does not make vcredist_x86.exe or vcredist_x64.exe file!Microsporophyll
P
0

Thanks for your help folks!

For me, just adding qwindows.dll to the /platforms directory somehow didn't cut it.
I finally got everything to work by bluntly copying the entire plugins directory to my application's binary directory and creating a qt.conf file with the following content:

[Paths]
Plugins=./plugins
Particular answered 28/12, 2013 at 21:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.