'Qt application cannot run in release
I am using visual studio 2017 and qt 5.12.9 msvc2017_64.
When I compiled the program in "Debug x64", the application worked fine. When I compiled the program in "Release x64", the program can be compiled successfully without any error, but the application cannot be opened and showed nothing (no warning, etc.). I used the windeployqt.
Then, I tried to debug the program in "Release x64" and the visual studio showed me something in the following image.
What should I do to make the program run in release? Thanks for help.
Solution 1:[1]
This is because windeployqt will not copy all required dll to release the directory. There is some missing dlls that you need to copy manualy. There is two way to find it out.
- Use a dependency walker. identify the missing library and copy it to your release directory.
- Copy the following folder from C:\Qt\Qt5.12\5.12.9\msvc2017_64 to the folder where, your exe is located
plugins
qml
translations
mkspecs
Copy all dll from C:\Qt\Qt5.12\5.12.9\msvc2017_64\bin folder to root folder of your exe.
also create qt.conf filed and all following lines to it
[Paths]
Prefix=.
Libraries=lib
Plugins=plugins
Qml2Imports=qml
Translations=translations
Headers=include
Documentation=doc
Now run your exe. after the program runs. try to delete some dll. if the program is using any dll, it will not get deleted. by doing this unused dll will be removed. similar try with qml folder and plugin folder.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | 8-DK |

