Deploying Qt 5 App on Windows

Deploying Qt 5 App on Windows

After some hours digging in the Qt Forums, I found out that I need to copy the "qml" folder (normally located in C:/Qt/5.2.1/qml) to the application's root directory. After doing so, both the dynamic and static versions of my application worked on vanilla systems.


Program directory (MinGW 4.8 32-bit, dynamic):

As hyde said, use the windeployqt tool (<qt path>\<version>\bin\windeployqt.exe) to copy the necessary files to your application's folder. After that, copy the required QML components from <qt path>\<version>\qml\ to your application's folder. The resulting folder should look similar to:

  • platforms (folder)
  • QtQuick (folder)
  • QtQuick.2 (folder)
  • Any other QML components that you need
  • app.exe
  • icudt51.dll
  • icuin51.dll
  • icuuc51.dll
  • libgcc_s_dw2-1.dll
  • libstdc++-6.dll
  • libwindthread-1.dll
  • Qt5Core.dll
  • Qt5Gui.dll
  • Qt5Qml.dll
  • Qt5Quick.dll
  • Qt5Network.dll
  • Qt5Widgets.dll

Program directory (static)

Compile the application statically, then copy the required QML components from <qt path>\<version>\qml\ to your application's folder. The resulting folder should look similar to:

  • QtQuick (folder)
  • QtQuick.2 (folder)
  • Any other QML components that you need
  • app.exe

I think the cause for the crash was that the Qt5Gui.dll (dynamic and static) "tried" to load the QtQuick* folders during run time, but could not find them (thus crashing the application during load).

Deploy Qt program to Windows from Linux

You're missing several files needed around the executable.

Get them under "Qt Dir \ Qt Version \ MinGW Version \ plugins \"

Required :

  • imageformats\

    • qgif.dll
    • qico.dll
    • qjpeg.dll
    • qwbmp.dll
  • platforms\

    • qwindows.dll (that's what the error is talking about)

(if in Debug mode, use these files with a "d" at the end, for example qwindowsd.dll)

I'm not sure about the imageformats, but I had to use them even in programs not using pictures. Try with "platforms\qwindows.dll" first, then add the imageformats if the programs asks to.

See https://doc.qt.io/qt-5/windows-deployment.html for the full info and more precise options. I'm just giving you the explanation.

Trouble deploying QT exe for Windows

Have you tried the Qt Windows deployment tool?
http://doc.qt.io/qt-5/windows-deployment.html
You drag the exe of your program over the WinDeploy.exe tool, then it resolves anything. There is similar for linux too.

Deploy Qt to Windows on a Linux machine

Yes, it's of course possible.

  1. You have to cross-compile Qt using the MinGW compiler, targeting Windows.

  2. You'll have to patch and build windeployqt yourself. By default, windeployqt is looking for g++.exe in the path. Of course this makes no sense on a linux build host, so you'd have to tweak it so that it finds the correct compiler and runtime libraries.

  3. You can then build your application using the cross-targeted Qt build, and deploy all the necessary artifacts into some deploy folder using windeployqt.

  4. To package the deployed build, you can run nsis or wix on Linux as well, to obtain a Windows installer. You can even sign the executable files (required these days for Windows), there's an open source tool called osslsigncode - it works on most platforms and doesn't require Windows.

It'll take a bit of time for you to figure it all out. It's certainly easiest to just build on Windows and not mess with it. But if you insist on building on Linux - you certainly can.

Qt Creator - How to deploy application using static parameter

after checking options mentioned, I have found visualized here,
Which is quite easy way, however time consuming...

only one point for future googliers, DON'T FORTGET to fix the sqlite parameter, otherwise 7 hours long process will get stuck in the middle, and you will have to start over again as me :)

How to deploy Qt apps developed in OS X to Windows?

Though @Massimo Callegari provided a resourceful answer, I did not use it achieve my task, probably because my project was massively complicated. Instead I came across this wiki page instruction to deploy Windows Qt apps. It works like charm, and I though I should document it here since it would be really helpful to new learners just like me. My project uses various 3rd party libraries like QCustomPlot, QXlsx. So the point I am implying is that the method described link regardless whether your project uses Qt native modules or 3rd party modules. But I presume this may not be the most elegant way to deploy an app (I think using installation packager along with installation softwares like InstallShield is the optimal solution) but nevertheless this method gets the job done. Cheers.



Related Topics



Leave a reply



Submit