Qt 5.0 program runs in QtCreator but not outside

This is a dependency problem that your program can not load its dependencies, copy dependency files (DLL files) to application directory is a temporary way, this is very risky way that your application may faced with problems in target machine, if target machine does not have correct version of Microsoft Runtime Library installed on them, your application can not run correctly, you can find which dependenices (DLL files) your application needs them with Dependency Walker.

There are two ways to solve this:

First one is to use Microsoft Visual C++ 2010 Runtime components in your installshield (or another versions depends on which version of Runtime library you compiled with it), that user could install it silently, or install with its executable binary without use installshield, and later copy DLL files to application directory and distribute it.

Second is use static compilation method to avoid such problems like that, but for static compile of your application you need a Commercial License if you want to distribute it on target machines.

For Deploy Your Application on target machines:

1) Put Microsoft Visual C++ 2010 Runtime Library in your application folder, so user will install it on their machine.

2) Copy application required dependencies (DLL files) from Qt's bin folder in your application folder (bin folder path:C:\Qt\Qt5.0.2\5.0.2\msvc2010\bin).

3) Copy imageformats folder from your Qt's plugins folder in your application folder (if you use any image resource file in your application).

4) Copy platforms folder from your Qt's plugins folder in your application folder.

Qt’s plugins folder path: C:\Qt\Qt5.0.2\5.0.2\msvc2010\plugins\

Leave a Comment