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... ^_^

Comments

  1. 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.

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

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

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

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

    ReplyDelete
  6. 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

    ReplyDelete
  7. 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".

    ReplyDelete
  8. 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~

    ReplyDelete
  9. 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...

    ReplyDelete
  10. good job ... thanks

    ReplyDelete

Post a Comment

Popular posts from this blog

Access GPIO from Linux user space

Launch an app from Android shell terminal