You are on page 1of 10

Home

PUBLIC

Stack Overflow

Tags
Application failed to start because it could Ask Question

Users
not find or load the QT platform plugin
Jobs
“windows”
Teams
I have looked through all of the
Q&A for work
questions that appear to be related on
21 stack overflow, and none of the
Learn More
solutions seem to help me.

I am building a Qt application with this


setup:
5 • Windows 7 Professional x64
• Visual Studio 2012
• Qt 5.2.0 built with configure -
developer-build -debug-and-
release -opensource -nomake
examples -nomake tests -platform
win32-msvc2012 -no-opengl

• Project uses QtSingleApplication


(qt-solutions)
• Application is a 32 bit application
• qmake run with the following: -
makefile -spec win32-msvc2012
• .pri uses QMAKE_CXX +=
/D_USING_V110_SDK71_

I can build and run my program fine


on my development machine (noted
above); I can also install and run the
package from Program Files directory
on dev machine.

When I install and run on a Windows


Vista machine (multiple machines)

• VC++ redist 2012 11.0.61030.0


installed
• VC++ redist 2010 10.0.40219
installed
• plus 2005, 2008 versions of redist

(also fails on a clean install of


Windows 7)

I get:

Application failed to start because


it could not find or load the QT
platform plugin "windows"
By using our site, you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service.
So I followed the instructions and
added a .platforms/ directory, and
added qwindows.dll (also added
qminimal.dll and qoffscreen.dll); I also
added libEGL.dll, libGLESv2.dll (even
though I shouldn't need them I don't
think)

Once I added qoffscreen.dll I now get


the additional message: Available
platform plugins are: offscreen

If I run through Dependency Walker I


get this error listed:

GetProcAddress(0x76CA0000 [KERNEL32.DLL], "GetCurrentPackageId") called from


"MSVCR110.DLL" at address 0x6AC6FDFA and returned NULL. Error: The specified procedure
could not be found (127).

and then further down get the:

GetProcAddress(0x745A0000 [UXTHEME.DLL], "BufferedPaintUnInit") called from


"COMCTL32.DLL" at address 0x745FFBF8 and returned 0x745AE18C.
This application failed to start because it could not find or load the Qt platform
plugin "windows".

Available platform plugins are: offscreen.

Reinstalling the application may fix this problem.

Any ideas how to fix this dll issue?

c++ qt dll platform

edited Jan 22 '14 at 17:50

asked Jan 21 '14 at 20:35


gollumullog
804 2 11 21

1 See if this helps -


stackoverflow.com/a/11185037/492
336. Pay particular attention to -
"You will be able to target Vista with
VS2012 but not with the public
beta. The beta redistributable,
confusingly, used to install on Vista
but did not work there. ". I surmise
from it that if you use the public
beta, the redistributable will install,
but the program will not run.
– sashoalm Jan 22 '14 at 6:02

I'm confused about your comment. I


am building on Windows 7 x64
machine. Also not using a beta. I'm
targeting the application for use on
Windows XP, Vista, and so on.
– gollumullog Jan 22 '14 at 17:49

1 @sashoalm thank you! My issue


was with a different release and
different compiler (Qt5.6.0, VS
2015), but ultimately using the
public release dlls for Qt instead of
the public beta dlls solved the issue
for me. – hlongmore May 16 '16 at
20:29read and understand our Cookie Policy, Privacy Policy, and our Terms of Service.
By using our site, you acknowledge that you have
1 Possible duplicate of Qt5 Static
Build yields Failed to load platform
plugin "windows" – Jim G. Oct 30
'16 at 13:09

12 Answers

The error is caused because the


program can't find qwindows.dll
22 qwindows.dll has to be in a folder
named platforms so that the path
from your executable to the dll is
platforms/qwindows.dll

Whereas this wasn't enough in my


case. I had also to add following line
at the beginning of my main()

QCoreApplication::addLibraryPath("./");

Then everything worked.

answered Aug 12 '14 at 14:00


Jan Moritz
1,110 1 13 24

1 Great, with addLibraryPath it's


worked! Note that you have to call it
before constructing QApplication
– Dmitry Ilukhin Nov 14 '16 at 9:57

 

I got this issue and how I solved it:

1. Used dependency walker


9 (http://www.dependencywalker.co
m/) to see the exact path of the
dlls needed. Try it because both
QtCreator and QT framework
both have the same dlls and you
must pinpoint the exact ones
used. I copied all dlls needed in
the same folder as the app.
2. I have copied the folder platforms
from QT framework /plugins and
copied it in the same folder as the
app. Now the app comtained also
plugin/platform/ folder with all its
dlls
3. And the most important step in
my case is to create a file named
qt.conf in the same folder as the
app
By using our site, you acknowledge that you . This
have readfile
andshould contain
understand the
our Cookie Policy, Privacy Policy, and our Terms of Service.
path to the plugins. My qt.conf file
contains:

[Paths]
Libraries=../lib/qtcreator
Plugins=plugins
Imports=imports
Qml2Imports=qml

answered Apr 10 '14 at 7:57


Lucian
442 7 24

Thanks, that worked for me for


windows XP SP3. I ended up with
these dll's, along with my
application, which enabled both
DEBUG and RELEASE versions to
work (Basic GUI + XML, in this
case) : icudt52.dll icuin52.dll
icuuc52.dll msvcp120.dll
msvcp120d.dll msvcr120.dll
msvcr120d.dll Qt5Core.dll
Qt5Cored.dll Qt5Gui.dll Qt5Guid.dll
Qt5Widgets.dll Qt5Widgetsd.dll
Qt5Xml.dll Qt5Xmld.dll
vccorlib120.dll vccorlib120d.dll
plugins\platforms\ qminimal.dll
qminimald.dll qoffscreen.dll
qoffscreend.dll qwindows.dll
qwindowsd.dll – Parallel Universe
Jun 14 '14 at 8:15

I was forced to add both


libGLESv2.dll and libEGL.dll to
above list to avoid this problem on
qt5.3.1. – dvpublic Aug 11 '14 at
7:13

The application is able to run on the


host system, since the Qt bin path is
8 in the system PATH variable.

There is a standard Qt tool for


deployment of Qt applications on
Windows windeployqt to be able to
run the application on target machines
that do not have Qt installed.

That tool takes care about Qt DLL


dependencies, makes a copy of
platforms\qwindows.dll and also it
makes a copy of libraries that you
cannot detect with the Dependency
Walker, since image plugins and
some other DLLs are loaded at
runtime.

You do not even need to have your Qt


bin folder in your environment PATH .
The simplest deployment:

• copy built exe binary to a new


folder
• open cmd console in that folder
By using our site, you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service.
• call windeployqt using the full
path (if it is not in the system
PATH ) and provide your
executable, for example:

c:\Qt\Qt5.2.1\5.2.1\msvc2010_opengl\bin\windeployqt

As a result you have in that folder all


needed Qt DLLs to run the
application.

The tool windeployqt has various


options. It can also take care about
deployment of qml related files.

Of course you can have also issues


with MSVC redistributables, but those
should be deployed separately and
installed once per system.

Only some 3rd party libraries should


be copied manually if they are used,
for example OpenSSL.

edited Oct 22 '15 at 23:23

answered Oct 22 '15 at 23:09


Orest Hera
5,976 2 13 30

This gives me Unable to find the


platform plugin.
– Stepan Yakovenko Jun 8 '18 at
5:38

 

I had the same issue "Application


failed to start because it could not find
4 or load the QT platform plugin
"windows" I fixed this by copying
below files to the app.exe (my app
executable) folder,

Qt5Core.dll, Qt5Gui.dll,
Qt5Widgets.dll and a "platforms"
directory with qminimal.dll,
qoffscreen.dll, qwindows.dll.

By using our site, you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service.
I hope this will help someone

answered Mar 1 '17 at 9:50


Amar
51 5

Note this issue can also be caused if


the search path for qwindows.dll that
3 is encoded in your app includes the
path where you installed Qt. Consider
the following scenario:

1. I install Qt to c:\Qt\...
2. I develop an app and deploy it
correctly somewhere else.
3. It runs on any computer properly
because it includes qwindows.dll
in a subdirectory.
4. I upgrade my local Qt to a new
version.
5. I try to run my app again.

The result is this error, because the


qwindows.dll in c:\Qt\... is found
before the one in its local directory
and it is incompatible with it. Very
annoying.

A solution is to place a file qt.conf in


the same directory as your exe file. I
don't know how to avoid this. If you
used the tool windeployqt.exe to
deploy your app, so you have a
subdirectory called platforms , then
this is sufficient:

[Paths]
Plugins=.

answered Jun 3 '15 at 10:15


Timmmm
36.9k 30 197 251

 

For the people who have this problem


in the future - I have a dirty little hack,
2 worked for me. Try at your own risk.

Follow all the steps in Initial


deployment (Quick and dirty)
[http://wiki.qt.io/Deploy_an_Applicatio
n_on_Windows]
By using our site, you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service.
1. Close Qt Creator.
2. Copy the following into
C:\Deployment\ The release
version of MyApp.exe All the .dll
files from C:\Qt\5.2.1
\mingw48_32\bin\ All the folders
from C:\Qt\5.2.1\mingw48_32
\plugins\
3. (If you used QML) All the folders
from C:\Qt\5.2.1\mingw48_32
\qml\ Rename C:\Qt\ to
C:\QtHidden\ (This turns your PC
into a clean environment, just like
one that doesn't have Qt
installed).
4. Launch
C:\Deployment\MyApp.exe.

Now for the hack -

1. Duplicate your folder for safety


2. If your file was in
/cat/Deployment, go to /cat
3. Now, delete the Deployment
folder while the .exe is still
running.
4. It will tell you that it cannot delete
certain files, so say Skip(or skip
all)
5. What you're left with is the list of
all the .dll files that your .exe was
actually using and could not
delete: the list of all the files and
only the files that you need to
keep.

You can close the .exe file now. To


check whether it is deploying okay, go
into the folder where you installed it,
say C:/Qt and rename it to C:/NotQt
(basically make Qt invisible to the
system). If it works now, it will deploy
on other systems more often than not.

answered Jun 30 '16 at 15:09


vc669
331 2 8

Well I solved my issue, although I'm


not sure what the difference is:
1 I copied every dll from my qt directory
into both ./ and ./platforms of my
application directory.

The application got past the error, but


then crashed.

VERSION.dll was causing the crash


(noted in dependency walker), so I
removed
By using our site, you acknowledge that you haveitread
fromand
both places. our Cookie Policy, Privacy Policy, and our Terms of Service.
understand
The Application started up, so I
systematically removed all unneeded
dll's.

This got me back to the same state I


had originally.

I then uninstalled my application and


re-installed (with only
the ./platforms/qwindows.dll file
remaining), application works
correctly.

So all I can assume is that I had an


incorrect version of qwindows.dll in
the platforms directory.

answered Jan 22 '14 at 18:43


gollumullog
804 2 11 21

I got the same issue: 1. it can run in


VS2010; 2. it can run in a folder with
1 files as: app.exe
\platforms\qwindows.dll ...

1. but it failed to load qwindows on


a clean machine with same OS
as the developing one.

Solved simply by move the platform


folder to plugins: app.exe
plugins\platforms\qwindows.dll

plus: qwindows.dll can be renamed as


any you like as it is queried by an
plugin interafce:
qt_plugin_query_metadata()

answered May 13 '14 at 7:43


chime
11 1

It's missing qwindows.dll, which


normally should be in platforms,
1 unless you add:

QCoreApplication::addLibraryPath("<yourpath>"

If you don't do this btw, and put your


qwindows.dll somewhere else, Qt will
search your PATH for the DLL, which
may take a LOT of time (10s - several
minutes)!

answered Jun 5 '15 at 15:21


Ruud van Gaal
109 7

 
By using our site, you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service.
 
For me, I needed to set
QT_QPA_PLATFORM_PLUGIN_PATH to the
platforms directory and then it worked.
1
For what it's worth, this solution was
also mentioned on GitHub.

edited May 23 '17 at 12:03


Community ♦
1 1

answered Jun 20 '16 at 8:54


RuiDC
3,209 5 21 19

Tried all the above - turned out for me


it was simply because I didn't have
0 the main Qt dlls in the apps folder

• Qt5Core.dll
• Qt5Widgets.dll
• etc

edited Jul 26 '16 at 16:33


FredMaggiowski
1,773 2 16 34

answered Jul 26 '16 at 13:34


Rob Hirst
1

I fixed this by placing qt.conf in my


application's exe folder:
0 [Paths]
Prefix=C:/Qt/Qt5.11.2/5.11.2/msvc2017

Where:

1. I have installed a custom Qt kit in


C:\Qt\Qt5.11.2\5.11.2\msvc2017

2. qt.conf informs the app where


the custom kit via the Prefix
property. Note use forward
slashes not backslashes (!)
3. And, optionally, the Qt kit's bin
folder is included in my PATH
environment variable

Defining Prefix in your qt.conf file


allows it to find the qwindows.dll
platform plugin when your app starts.

answered Oct 25 '18 at 12:20


Stephen Quan
11.5k 2 51 54

 

By using our site, you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service.
protected by Community ♦ Oct 30
'16 at 12:43
Thank you for your interest in this
question. Because it has attracted low-
quality or spam answers that had to be
removed, posting an answer now
requires 10 reputation on this site (the
association bonus does not count).

Would you like to answer one of these


unanswered questions instead?

By using our site, you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service.

You might also like