Qt5 - Why the .exe don't run anything when make a deployment?

时间:2019-04-08 13:09:21

标签: windows qml qt5

I have a problem with building an application file (*.exe) on windows. I create a simple project and run on QtCreator the result is:

Result

It hasn't any error and warning. After that, I build it with release using kit is Desktop Qt 5.12.1 MSVC2017 64-bit, I got a folder release after rebuild with qmlTest.exe

To continues, I deploy it to follow this link Deployment Qt apps on Windows

I got some files into the release file of my project

enter image description here

But when I click on qmlTest.exe nothing appears, no error, no missing dll files notifications. I checked process task and no qmlTest was running.

Who can tell me what I was wrong?

Thanks for your kind help!

1 个答案:

答案 0 :(得分:1)

您缺少一些文件夹和文件,例如QtQml和QtQuick等。 Qt拥有一个名为“ windeployqt.exe”的工具来完成此操作。

它在控制台中的使用方式如下:

windeployqt.exe --dir PATH_TO_DEPLOY --compiler-runtime --release --qmldir PATH_TO_QML MY_EXE
  • PATH_TO_DEPLOY:一个空文件夹,您希望在其中复制依赖项
  • PATH_TO_QML:存放qml文件的文件夹
  • MY_EXE:可执行文件的路径

因此,在您的情况下,它看起来像这样:

 C:\Qt\5.12.1\msvc2017_64\bin\windeployqt.exe --dir C:\Users\...\Desktop\deployFolder --compiler-runtime --release --qmldir C:\Users\...\Desktop\QmlTest\qml C:\Users\...\Desktop\build-qmlTest-Desktop_Qt...-Release\release\qmlTest.exe

运行该工具后,所需的所有文件都将位于deployFolder中。您只需要从release文件夹复制可执行文件即可。 可以在这里找到更多信息:https://doc.qt.io/qt-5/windows-deployment.html

相关问题