Qt 5 and " Failed to load platform plugin 'windows' " error


Once finished to develop your application using the great Qt libraries the next step will be release phase. Here you need to provide in addition of the main executable all the dll libraries dependencies required by your application to run. Basically, since the application was developed using Qt, the dependencies will be only Qt dll and some few dll connected to the compiler used.

To detect which dll are required by your executable there is an useful tool called Dependency Walker. Using this tool you'll can get a tree list of all dependencies of your executable. However the main subject of this post is related to a specific error showing up if no all dependencies are provided. If we check a standard executable generated using basic Qt features we'll have a list of dll dependencies very similar to the following:

Qt5Core.dll
Qt5Gui.dll
Qt5Widgets.dll
libGLESv2.dll
icudt51.dll
icuin51.dll
icuuc51.dll

Unfortunately if we try to run our executable the following error will show up:

Failed to load platform plugin 'windows'

Googling around it seem the cause of this error is the missing windows plugin as the message suggest. For fix this error is necessary to create a new folder called platforms in the same position where are the executable and all other dll and put inside this folder the qwindows.dll library. Now the program should run correctly but if the same message above show up again is very probably there is one additional dependency to provide. Dependency Walker tool showed us all the dependencies of the executable but in this case the missing dll is required by the qwindows.dll plugin just added and loaded by our application. Since the plugin doesn't find the required dll refuse to load and this return the error in topic that is a bit too much generic for help us. Anyway the missing dll that you need to put together with all other is the following:

libEGL.dll

Now the application should run correctly. If still doesn't run it depends from another problem that I currently don't know since never faced right now, I'm sorry... ^_^

11 Comments:

great solution for me bro, thanks. btw, the first choice you offer ddn't work for me. even after I add QT_PLUGIN_PATH to the system environment.
but the second one did solve it.

January 2, 2014 at 8:42 AM comment-delete

It works. Adding libEGL.dll solved the problem. Thank you :)

Anonymous
February 10, 2014 at 7:37 AM comment-delete

thank you very much :) copying libEGL.dll solved it for me !

Anonymous
June 18, 2014 at 4:58 AM comment-delete

Brilliant, Same here!
Surprising that this is required and the QT guys dont seem to mention it. Thanks for your sleuthing work!

Anonymous
June 23, 2014 at 1:20 AM comment-delete

from where i get ' qwindows.dll library'
and where should i but it pleas help me

OMAR
July 17, 2014 at 12:05 AM comment-delete

Men i made new folder
called him like u said
C:\Windows\System32\platforms
and i but on it qminimal.Dll and qwindows.Dll
and still same msg box help me pls

Tyor
July 17, 2014 at 1:12 AM comment-delete

Hi

Read better the post here:

"is necessary to create a new folder called platforms in the same position where are the executable and all other dll"

this mean you have to create the "platforms" folder in the same path you installed your software (ex. c:\program files\my_software_name\platforms). You can find the qwindows.dll in your Qt installation folder under the library set you selected for develop (msvc20xx, mingw and so on). Subfolder "plugins\platforms".

July 17, 2014 at 1:41 AM comment-delete

oh bro ty it works and here is another msg :'(
PROG HAS STOPPED WORKING

Aproplem caused the propleam to stop working corectly , pls close prog~

tyor
July 17, 2014 at 5:01 AM comment-delete

Sorry but if the program run mean all the required dll was found. This error come from something different that I never faced than can not help you...

July 17, 2014 at 1:06 PM comment-delete

good job ... thanks

Anonymous
October 23, 2015 at 12:42 AM comment-delete

Thank you :)

May 27, 2016 at 6:27 PM comment-delete

Post a Comment