0

I make Windows application. When I run it on my local computer with QT installation - everything is OK.

But when I run it on another W10 PC or W28R2 server, I get known error.

This application failed to start because it could not find or load the Qt platform plugin "Windows" Available platform plugins are: "windows"

I read all threads about this, but no find solution.

My failed steps

  1. copy libEGL.dll into the myapp dir
  2. copy libEGLSv2.dll into the myapp dir
  3. insert qwindows.dll into the myapp dir
  4. insert all dlls :-) into the myapp dir
  5. create QT_QPA_PLATFORM_PLUGIN_PATH variable in the project settings
  6. run myapp with -platform and -platformpluginpath parametters
  7. use qt.conf file with QT_QPA_PLATFORM_PLUGIN_PATH parameter

Interesting is, that when I rename "MYPATH\Qt\5.6\msvc2015_64\plugins\platforms" directory from "platforms" to "platformsX", application on my local computer also begins crash.

It looks like a poorly filled global variable, but nothing works for me.

This sloution was marked as duplicate with "Qt5 Static Build yields Failed to load platform plugin "windows"". But here missing windeployqt.exe myapp.exe --dir myapp_deps I write that thread and apply all advices, but still had the same problem.

exo
  • 373
  • 5
  • 22
  • `qwindows.dll` should be put into `myapp\platforms\\` – Zen May 25 '16 at 15:34
  • 1
    Possible duplicate of [Qt5 Static Build yields Failed to load platform plugin "windows"](http://stackoverflow.com/questions/16773789/qt5-static-build-yields-failed-to-load-platform-plugin-windows) – Jim G. Oct 30 '16 at 13:09
  • Do you read my problem, my corrective steps that did not work? All was from thread you signed as duplicate. – exo Nov 01 '16 at 12:36

1 Answers1

3

By default Qt looks for its plugins in the application directory, but you must keep the plugin subdirectories as well.

In your case just copy qwindows.dll into myapp\platforms dir so your app can find the plugin.

Better yet, use the windeployqt.exe app bundled with your Qt installation and it will copy all the required Qt libraries and plugins.

For example i use the following as part of my deployment script:

windeployqt.exe myapp.exe --dir myapp_deps

This will copy all the required Qt libraries, plugins and VC++ redistributables (if you have VCINSTALLDIR/VSINSTALLDIR env correctly configured) to the myapp_deps directory. (Note: if you omit the --dir argument then the command will copy all the dependencies to the current directory where myapp.exe resides).

After this if you put myapp.exe into myapp_deps and relocate the folder to another PC without Qt installed then myapp.exe will run.

codestation
  • 2,938
  • 1
  • 22
  • 22
  • Super! Thanx for solution. I test it in the past, but without succes. Now I noticed, that there are more than one windeployqt.exe utility. One utility for each one platform. I might have in the past triggered the wrong version of the utility. – exo May 26 '16 at 10:15