Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I've written a couple of applications in QML (part of Qt 5). In a question that I've made before (https://softwareengineering.stackexchange.com/questions/213698/deploying-qt-based-app-on-mac-os-x), I found the solution for deploying my app on OS X (using the macdeployqt tool).

Deploying Qt4 apps on Windows was easy:

  1. You compiled it in release mode.
  2. You copied the necessary libraries (DLLs).
  3. You tested and it worked.

Unfortunately, this approach did not work in Qt5 (I even included the platforms folder with the qwindows.dll file and it did not work). After some days of trying, I gave up and compiled a static version of Qt5.

Again, it did not work. The app works on a PC with Qt installed, but it crashes on "clean" PCs. As a side note, Windows 8/8.1 systems don't give a warning or a message notifying me about the app's crash. But in Windows 7 a message notifies me that the application crashed.

I've tried running Dependency Walker (depends.exe) and all libraries in the static build of my application seemed fine.

In Windows 8, I don't get any error. But after profiling the app in depends.exe, I get an access violation originating from QtGui.dll. The exact error is

Second chance exception 0xC0000005 (Access Violation) occurred in "QT5GUI.DLL" at address 0x61C2C000.

Is there something that I am missing (say an extra DLL or config file)?

Application information:

  • Written and compiled with Qt 5.2.1
  • Uses Quick/QML.
  • Uses the network module.
  • Uses the webkit module.
  • Uses the bluetooth module.
  • The QML files are written in Quick 2.2
question from:https://stackoverflow.com/questions/22185974/deploying-qt-5-app-on-windows

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
236 views
Welcome To Ask or Share your Answers For Others

1 Answer

Starting from Qt 5.2, there is windeployqt tool you can use. Just run it from command line to get help. But basic usage is, give it the .exe file, it will copy Qt dependencies to go with it.

You will want to use --qmldir option to let the tool know where your QML files are, so it can figure out the needed QML dependencies.

Note about testing: to make sure you have everything, test in computer with no Qt SDK, or temporarily rename the Qt directory. Otherwise the application might find missing files from there...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...