-1

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!

Chinh Nguyen Huu
  • 123
  • 3
  • 11
  • The reason for such behavior is only one - you miss some necessary files. I can only assume that you miss QML files/plugins from `QTDIR/qml`. Use [this](https://doc.qt.io/qt-5/qtquick-deployment.html) doc instead or [this](https://stackoverflow.com/questions/25049116/deploy-qt5-qml-application) question/answer. – folibis Apr 08 '19 at 14:03
  • Try running it after starting DebugView so that you can see any output it might print: https://learn.microsoft.com/en-us/sysinternals/downloads/debugview – Mitch Apr 08 '19 at 15:32
  • Win10 no longer screams loudly when a program crashes with an unhandled exception. Look in the application event log for the crash reason. Put the OS back into programmer mode with the advice in [this answer](https://stackoverflow.com/a/53277326/17034). – Hans Passant Apr 09 '19 at 12:42

1 Answers1

1

You are missing some folders & files like QtQml and QtQuick etc.. Qt has a tool called "windeployqt.exe" to do exactly this.

It is used from the Console like this:

windeployqt.exe --dir PATH_TO_DEPLOY --compiler-runtime --release --qmldir PATH_TO_QML MY_EXE
  • PATH_TO_DEPLOY: an empty folder where you would like the dependencies to be copied
  • PATH_TO_QML: the folder where you have your qml files
  • MY_EXE: path to your executable

So in your case, it would look something like this:

 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

After running the tool, all the files you need will be in the deployFolder. You just have to copy the executable from the release folder and you're done. More infos can be found here: https://doc.qt.io/qt-5/windows-deployment.html

luffy
  • 2,246
  • 3
  • 22
  • 28
  • The best answer, it's work for me, thank you very much but you still forget a final step to copy a `qmlTest.exe` into the folder that was built – Chinh Nguyen Huu Apr 09 '19 at 14:38