andseg andseg - 1 month ago 25
C++ Question

(Qt 5.7.0) Could not find or load the qt platform plugin "windows"

Bear in mind that all of this is with Qt Creator (5.6.1 and 5.7):

I have a project made in my work machine (Win7, 64bits, compiled with MinGW 5.3.0 32bits in Qt 5.6.1). It works perfectly both in debug and release mode.

Soon after, I decided to test my program in another machine (WinXp, 32bits). I just passed the executable and the .dll. Still working like a charm.

Later, i tested the SAME version of my program in my gaming machine (Win10, 64bits). Weirdly, it didn't work at all. I received the following error:




"could not find or load the qt platform plugin "windows"".




I remembered that if there is a .dll missing, this error occurs. So I passed all the .dll from Qt folder to my program folder (with the intension of deleting the unwanted latter). Much to my surprise, it still didn't work. But the error was diferent:




"could not find or load the qt platform plugin "windows"... Available platform plugins are: minimal, offscreen, windows, minimal, offscreen, windows."




It very clearly found the platform plugin windows (either qwindows or qwindowsd... or both in that matter), but it could not load it. Any ideias why?




EDIT: All .dll in
C:\Qt\5.7\mingw53_32\bin
was copied and pasted to the folder with the executable.

All folders in
C:\Qt\5.7\mingw53_32\plugins
were copied and pasted to the folder with the executable.

Thats pretty much all the .dll I added!

Answer

WHY THE PROBLEM OCCURRED

Honestly, I don't know. But it very much seems like "Alexander Saprykin" answer is correct. During the process of testing, i had to update my Qt so it could fairly well be only a version mismatch.

Also, the fact that when I redid my build using only Qt 5.7.0 it worked, implies that it was indeed only a mismatch case.

HOW I FIXED IT

As told by "Sebastian Lange" in the comments, using windeplyqt.exe did the job. I just deleted everything but the .exe in my build folder, openned Qt5.7 command line, chaged directory to the same as my .exe and ran the command windeployqt . or windeployqt [name_of_exe].exe

Thanks to everyone!