jondinham
jondinham

Reputation: 8499

Qt application fails to run

I've just completed my application programmed with Qt. It runs fine with my Qt Creator, but when I copy the .exe from release directory with all neccessary dll files. It doesn't require any further dll files but it just crashes. What happened?

Problem signature:
Problem Event Name:       APPCRASH
Application Name:         agrisis.exe
Application Version:      0.0.0.0
Application Timestamp:    532025fe
Fault Module Name:        Qt5Cored.dll
Fault Module Version:     5.2.1.0
Fault Module Timestamp:   52ed6764
Exception Code:           c0000005
Exception Offset:         00216730
OS Version:               6.1.7601.2.1.0.256.48
Locale ID:                1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

I've copied all the dll files from Qt5 bin directory to my application directory but now it doesn't crash at Qt5Cored.dll anymore, it crashes at Qt5WebKitd (the application screen is shown fine but the web component fails to appear):

Problem Event Name:       APPCRASH
Application Name:         agrisis.exe
Application Version:      0.0.0.0
Application Timestamp:    53214fe7
Fault Module Name:        Qt5WebKitd.dll
Fault Module Version:     5.2.1.0
Fault Module Timestamp:   52ed99de
Exception Code:           c0000005
Exception Offset:         01d0a465
OS Version:               6.1.7601.2.1.0.256.48
Locale ID:                1033
Additional Information 1: a7aa
Additional Information 2: a7aa91f17ea749d42a4de3b390fa5b3d
Additional Information 3: a7aa
Additional Information 4: a7aa91f17ea749d42a4de3b390fa5b3d

Upvotes: 0

Views: 2862

Answers (2)

jondinham
jondinham

Reputation: 8499

Usually when running the .exe file a message will show up about missing dll. But for some dll files this message is not shown at all.

I copied all the dll file of Qt then tested by removing them 1 by 1.

Upvotes: 1

JKSH
JKSH

Reputation: 2718

You are probably missing a file that is only loaded at runtime (like a plug-in DLL). This guide will help you find those DLLs quickly. It assumes that:

  • The release version of your app works correctly when you build + run it from Qt Creator
  • Your (dynamically-linked) copy of Qt is installed in C:\Qt\5.2.1\mingw48_32\

Deployment files

Initial deployment (Quick and dirty)

  1. Close Qt Creator.
  2. Copy the following into C:\Deployment\
  3. The release version of MyApp.exe
  4. All the .dll files from C:\Qt\5.2.1\mingw48_32\bin\
  5. All the folders from C:\Qt\5.2.1\mingw48_32\plugins\
  6. (If you used QML) All the folders from C:\Qt\5.2.1\mingw48_32\qml\
  7. Rename C:\Qt\ to C:\QtHidden. (This turns your PC into a clean environment, just like one that doesn’t have Qt installed.)
  8. Launch C:\Deployment\MyApp.exe.

If your app worked correctly, congratulations! You are almost ready for deployment. You don’t want to ship a 1.5GB package though, so it’s time to clean up unused files.

If it didn’t work correctly, ask for more help.

Final deployment (Cleaned up)

Do the deletion steps below in C:\Deployment\ and all of its subdirectories. After each deletion, launch C:\Deployment\MyApp.exe and test it. If it stops working, restore the files you just deleted.

  1. Delete all the debug DLLs and keep the release DLLs only. (Debug DLLs end with ‘d’. For example, delete Qt5Cored.dll but keep Qt5Core.dll)
  2. Delete a few DLLs and test MyApp.exe. Repeat until you try all DLLs.
  3. (If you used QML) Delete a few .qml files and test MyApp.exe. Repeat until you try all .qml files.
  4. (If you used QML) Delete qmldir files from the folders that have no more DLLs or .qml files

When you have removed all the files that you don’t need,

  1. Rename C:\QtHidden\ back to C:\Qt\ to restore your installation.
  2. Distribute your app.

Adapted from: http://qt-project.org/wiki/Deploy_an_Application_on_Windows

Upvotes: 2

Related Questions