3

I've copied all of the dlls from QT that were required, and my application works fine on my Windows server machine.

However when trying to run it on a Windows 7 box i get the following message:

This application failed to start because it could not find or load he Qt platform plugin "windows".

Reinstallning the application may fix this problem.

Any ideas what I'm missing here?

Alosyius
  • 8,771
  • 26
  • 76
  • 120
  • 2
    You can get that information with a tool. For example, Dependency Walker (http://www.dependencywalker.com/) will tell you which component is missing. I suspect, you are missing some Windows run-time libraries your application links to. – vahancho Apr 25 '14 at 06:24
  • Maybe these: `#include #include ` ? – Alosyius Apr 25 '14 at 06:26
  • check this page http://stackoverflow.com/questions/20495620/qt-5-1-1-application-failed-to-start-because-platform-plugin-windows-is-missi – DNamto Apr 25 '14 at 06:29
  • @Alosyius, those are not dlls, but header files that refer to the Windows libraries. You need to know which library is missing on your deployment system. You can do that with the proposed tool. – vahancho Apr 25 '14 at 06:31
  • 2
    I was missing `/platforms/qwindows.dll` Thanks for the help!! – Alosyius Apr 25 '14 at 06:45

2 Answers2

3

I'd scratched my head over this some time ago. It turned out that this was caused not by missing qwindows.dll, but rather one of libEGL.dll or libGLESv2.dll. This was tricky, because dependency walker does not show those libs as direct dependencies.

If you want to test on your dev machine, whether your app has all required libs, fire up console issue SET PATH=, cd to your app directory and run it.

This is complete list of dlls that my app is using (Qt 5.2 / QtQuick app only, rest is C++). QtQuick is nice but the size of Qt dependencies is a bit scary:

icu*.dll - depending on whether you've compiled with ICU libEGL.dll libGLESv2.dll Qt5Core.dll Qt5Gui.dll Qt5Network.dll Qt5Qml.dll Qt5Quick.dll Qt5Widgets.dll

W.B.
  • 5,445
  • 19
  • 29
1

Widely used solution is put all necessary libraris in the folder of application.
What are libraries application need?
Run application and see error message:

The program can't start because <Library name> is missing from your computer.  
Try reinstalling the program to fix this problem

Library set is depended from Qt version. Run several times application and each time copy required lib you found what is neeeded for application.
In my case (Qt 5.2.1) there are

icudt51.dll, 
icuin51.dll, 
icuuc51.dll, 
libgcc_s_dw2-1.dll, 
libstdc++-6.dll, 
libwinpthread-1.dll, 
Qt5Core.dll, 
Qt5Gui.dll, 
Qt5Widgets.dll.

All libs you can found in your Qt install folder. But don't use libraries from Tools\QtCreator folder, because QtCreator has another version of these libraries!

In case of error:
This application failed to start because it could not find or load he Qt platform plugin windows. Reinstallning the application may fix this problem.
You should create folder platforms and copy qwindows.dll into it.
If you still got error you should create qt.conf file in application's folder with content:

[Paths]
Plugins=plugins

This solution is described in https://qt-project.org/forums/viewthread/37265 More information about qt.conf you can find at http://qt-project.org/doc/qt-5/qt-conf.html

In latest versions of Qt you can find deploy tool (since 5.2). This tool find necessary libraries for application and copy into application folder. You can run it something like this:

call c:\Qt\QtX.Y.Z\X.Y.Z\mingw48_32\bin\qtenv2.bat
cd /d "c:\path\to\your\application\folder"
windeployqt.exe your_application.exe

Generally it works well. But I notice that some libraries are not copied, but you can found by method is descibed at beggining of post. More useful information you can find at http://qt-project.org/doc/qt-5/windows-deployment.html

In rare cases yo can got this error if some library is missing but not appear in error message above. Example: Qt 5.1.1: Application failed to start because platform plugin "windows" is missing
I wasn't in this situation, so I can't tell more.

Community
  • 1
  • 1
Maxim Suslov
  • 4,335
  • 1
  • 35
  • 29
  • The problem is that the error message is misleading, to say the least. It tells you about platform library, where in fact what's missing is `libEGL.dll`. – W.B. Apr 25 '14 at 08:29
  • In your case - yes. In my practice I didn't face with that reason. Also Alosyius wrote: "I was missing /platforms/qwindows.dll" – Maxim Suslov Apr 25 '14 at 08:36
  • The new Depends app might help in these situations: https://github.com/lucasg/Dependencies – mBardos Nov 02 '21 at 13:24