Qt 5 platform plugin "windows"
After building the project release, I moved the exe file to a separate directory. Threw all the dlls that he asked for to run. As a result, it returns an error at startup:
This application falid to start because it could not find or load the Qt platform plugin "windows".
How do I get rid of this? How to compile correctly?
2 answers
You need to create a platforms folder in the program folder and copy it there qwindows.dll
Add {[3] to the beginning ofmain
]}
QStringList paths = QCoreApplication::libraryPaths();
paths.append(".");
paths.append("imageformats");
paths.append("platforms");
paths.append("sqldrivers");
QCoreApplication::setLibraryPaths(paths);
Here everything is described in detail http://habrahabr.ru/post/188816/
I recommend using the environment variable QT_DEBUG_PLUGINS=1
, i.e. run the following commands in the windows cmd:
set QT_DEBUG_PLUGINS=1
myQtApp
Then Qt will write where it tries to look for the plugin and a detailed description of the errors
For me (Qt 5.5, Windows 7 Pro), it tried to search for the plugin in the current directory in the platforms folder. That's where I put it. After that, it worked without changing the code or any other changes