0

I have a problem deploying my Qt 5.3.1 application. This is my folder structure:

platforms\
    qwindows.dll
    qminimal.dll
    libEGL.dll
sqldrivers\
    qsqlite.dll
Qt5Widgets.dll
icuin52.dll
libwinpthread-1.dll
libgcc_s_dw2-1.dll
icuuc52.dll
Qt5Sql.dll
Qt5Core.dll
program.exe
libGLESv2.dll
Qt5Gui.dll
libstdc++-6.dll
icudt52.dll
libEGL.dll

Application starts and works fine on a machine without Qt installed. I want it to start with Windows, so I modify the registry key HKLM\Software\Microsoft\Windows\CurrentVersion\Run. But when I log on to Windows, a have an error message:

The application failed to start because it could not find or load the Qt platform plugin "Windows". Reinstalling the application can fix this problem.

Then my application crashes. Please mention that I have provided platforms\qwindows.dll and libEGL.dll. Adding to PATH value ...\platforms\ does not help either. And everything is fine if I launch the application by clicking on it.

What else it could be?

UPD:

The only solution I could find on the Internet right now is to set environment variable QT_QPA_PLATFORM_PLUGIN_PATH to the directory which contains qwindows.dll. But it is not a great idea.

Solution:

The answer is here. Adding two additional command line parameters -platformpluginpath and path\to\qwindows\directory solved my problem.

Community
  • 1
  • 1
peschanko
  • 353
  • 2
  • 12
  • 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:11

1 Answers1

0

I think that it is due to the fact that when you launch an application from HKLM\Software\Microsoft\Windows\CurrentVersion\Run the working directory is not set (while in your case you should set it to the folder where the executable resides for letting things work as expected).

So you may try one of the solutions described here.

Community
  • 1
  • 1
Morix Dev
  • 2,700
  • 1
  • 28
  • 49