Qt 应用程序无法在发布版本中运行
我正在使用 Visual Studio 2017 和 qt 5.12.9 msvc2017_64。
当我在“Debug x64”中编译该程序时,该应用程序运行良好。当我在“Release x64”中编译程序时,程序可以成功编译,没有任何错误,但是应用程序无法打开并且没有显示任何内容(没有警告等)。我使用了windeployqt。
然后,我尝试在“Release x64”中调试程序,Visual Studio 向我展示了下图中的内容。
我应该怎么做才能让程序在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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是因为windeployqt不会复制所有需要的dll来释放目录。
缺少一些 dll,您需要手动复制。
有两种方法可以找到它。
从 C:\Qt\Qt5.12\5.12 复制所有 dll。 9\msvc2017_64\bin 文件夹到 exe 的根文件夹。
还创建 qt.conf 文件及其所有以下行
现在运行您的 exe。程序运行后。尝试删除一些dll。如果程序使用任何dll,则不会被删除。通过这样做,未使用的 dll 将被删除。类似的尝试使用 qml 文件夹和插件文件夹。
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.
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
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.