[SOLVED]Failed to load platform plugin "windows"
I am working on Qt5.0.0rc2 and build for VS2010 64bit. I installed the VS AddIn for the RC2. Compiling was successful with minor problems as ending 5s in the names of the libs preconfigured with the VSAddIn. Thats all Ok for me. I started a debug session and got the error message stated above.
Failed to load platform plugin "windows". Available platforms are:
none. No platforms were listed. I think there is one more abstraction layer introduced in Qt4.8 and mandatory for Qt5.0 but I do not find a way or hint how to build this plugins.
The platform abstraction has been completely reworked. The required plugins should have been built automatically, and they can be found in <code>qtbase/plugins/platforms</code>.
Thanks Lukas. After a little debugging I found that one enviroment variable was not set correctly. The name of this is "QT_QPA_PLATFORM_PLUGIN_PATH". After creating this varible in the enviroment and setting it to the path you explained above the program started normally. Thanx fine. That was fast. I can close the post.
This message is returned from a program that was built without
// This file is autogenerated by qmake. It imports static plugin classes for
// static plugins specified using QTPLUGIN and QT_PLUGIN_CLASS.<plugin> variables.
Please link to the documentation for this.
Some or all tests are built without this from
SOURCES += plugin_import.cpp
LIBS += Qt5PlatformSupportd.lib windowsd.lib rpcrt4.lib
Thanks. I will have a look at it as soon as possible. First I will install the Qt5 release version and the plugin VS release 1.2.0 to see of maybe the environment variable is set with the correct values.
Be aware that you will neither have to specify QT_QPA_PLATFORM_PLUGIN_PATH nor import the platform plugin (if you do not build statically) as long as you deploy it correctly to a folder named platforms relative to your application.
Btw. Lukas - can you create sticky threads?
Threads like "can't run from cmd" or "work's fine in creator but not on other machines" about the proper deployment on windows seem to flood this forum lately so maybe it would be beneficial to create a sticky thread with a simple "what you need" for each compiler eg. for MSVC:
- install MSVC runtime package
What do you think?
[quote author="Krzysztof Kawa" date="1357386479"]
- install MSVC runtime package[/quote]
Just a note about this: With VS2008 (MSVC 9.0) we indeed have to install the MSVC Runtime package, by running the MSVC Redistributable setup program. That's because VS2008 (and VS2005 too) uses WinSxS to manage the CRT DLL's - putting the required CRT DLL's into the same folder as the EXE file does not work. They have to be "registered" with WinSxS. Fortunately with VS2010 and VS2012 Mircrosoft has changed this again, so now the CRT DLL's are just "normal" DLL's you can put into the same folder as the EXE file and that's it :-)
And another pitfall: If you use a different compiler for your EXE file than for the Qt DLL's - for example you compile your EXE with MSVC 11.0 but then use the pre-compiled Qt DLL's (with MSVC 10.0) from the official "Qt libraries" package - you will end up with an EXE file that needs the CRT DLL's of MSVC 11.0, but also depends on the Qt DLL's that in turn need the CRT DLL's of MSVC 10.0. In the end you will have to ship both versions of the CRT DLL's for the application to work. This is easy to miss, because on a developer's machine usually all the run-times will be installed globally - because Visual Studio has been installed on the machine...
Conclusion: Whenever possible (e.g. license-wise) use the static Qt DLL's with the static MSVC CRT :-)))
[quote author="Krzysztof Kawa" date="1357386479"]What do you think?[/quote]
Having a deployment guide for Qt 5 is for sure quite a good idea, maybe a "Wiki article":http://qt-project.org/wiki/ or a "FAQ entry":http://qt-project.org/faq - which can be linked in a sticky thread or at least as reference one can point to.
The thing is - one who will find the Wiki article or the FAQ entry will find one of this existing threads too. One who doesn't usually won't find them either. ;-)
Nevertheless definitely a good idea!
Well there is "this page":http://qt-project.org/doc/qt-4.8/deployment-windows.html obviously but I feel beginners can be a little overwhelmed by the verbosity of the info, since unfortunately most of the time they expect to be told explicitly "copy this form here to there".
copy the libEGL.dll to there.
I am using MSVC 2012 and I am migrating from Qt4.8 to Qt.5.1 (or .2 I see it is available now)
I want to design a program which works on any PC (either XP, W7 and W8): checking this is cumbersome since my design PC has installe Qt and MSVC redistributable (as part of MSVC2012). In fact the program works perfectly on my PC.
I am distributing the program with the InstallShield package which come for free with MSVC2012
I understand I need to support the MSVC run time support (done)
If I run my application on most of PC I get the infamous error:
"This application failed to start because it could not find or load the Qt platform plugin "windows" "
I tried to manually add in the application path of the target pc (not my pc) the directories
plugins/platforms/ and put qwindows.dll inside but did not help
I am using MSVC project file and InstallShield (as I said). I can see many discussion on this point but I cannot find a conclusive solution for me.
What perfectly worked with Qt4 now is not with Qt 5 ...
thanks for your help
We had the same problem try adding more libs:
APP-DIR/Qt* // Libs being used
APP-DIR/icu* // Internationalization libs
APP-DIR/libEGL.dll // This one made our qindows.dll accepted in platforms <====
... any further libs
I solved adding platforms/qwindows.dll and the libs mentioned above
I am having the same problem.
First the error showed no available platforms.
Adding qwindows.dll to platforms made it show up as "available platforms : windows."
But that is still the next step in getting this error.
I added libegl.dll.
I don't have libGLEv2.dll
Thats after installing at the destination.
At home I have libglev2.dll but no libegl.dll.
(installed qt and mingw at both locations and its already different in available dll's.)
Even the quick and dirty trick isnt working.
So I wrote an app that only works on my computer. Great.
I am getting an error exactly as mentioned without any dll files in the error message when executing the release version of the built application, and an error related to QCore.dll as mentioned above when executing the debug version of the built application.
[quote author="abraker95" date="1402546761"]I am getting an error exactly as mentioned without any dll files in the error message when executing the release version of the built application, and an error related to QCore.dll as mentioned above when executing the debug version of the built application.[/quote]Hi, try http://qt-project.org/wiki/Deploy_an_Application_on_Windows
No luck. I checked to make sure I have the needed file structure, and made sure to include libEGL.dll.
[quote author="abraker95" date="1402547512"]No luck. I checked to make sure I have the needed file structure, and made sure to include libEGL.dll.[/quote]
Did you include all the DLLs and all the plugin folders?
Does your program run from Qt Creator?
If you answer "yes" to both questions, please post a screenshot of your deployment folder and post the exact error message. To post a screenshot, upload it to an image host (e.g. imgur, flickr) and link to it here.
I copied all the DLL's from the mingw48_32 and msvc2012_opengl folders and all folders within the plugins folder and the application still shows the same error. And no it doesn't work in Qt.
Hi your Qt version of mingw48_32 is 5.2.1 and your Qt version of msvc2012_opengl is 5.3.
Copying files from these releases together in one folder is alright, problem arises for the subfolders, in this case the platforms subfolder.
I'm guessing the files in there comes from the 5.2.1 version of Qt, and when qwindows.dll requests a Qt5xxx.dll it will fail because all the Qt5xxx.dlls are from the 5.3 version of Qt. Hence the "plugin" error.
EDIT: what I mean, the main problem is mixup of mingw48_32 and msvc2012 compiler technology, i.e. for a single .exe, it cannot both use .dlls from ming48_32 compiler and msvc2012_compiler.
The only DLL's I copied from the mingw48_32 folder is the platform since it's the only qWindows.dll I found. The rest of the DLL's come from the msvc2012_opengl folder and the QtCreator's bin folder (such as libEGL.dll).
Hmmm, I also have msvc2012_opengl installed and it has a qwindows.dll for sure.
Also, never copy anything from QtCreator's bin folder, because QtCreator for Qt version 5.3 is built with msvc2010 and Qt version 5.2.1. Best is to think about QtCreator's bin folder as private.
Then where do I copy libEGL.dll from? Many people claim it to have solved the platform error.
EDIT: libGLESv2.dll is also located there. The application requests that DLL and it is not located within the msvc2012_opengl's bin folder.
libEGL.dll and libGLESv2.dll are not needed for the msvc2012_opengl compiler.
If you want, you can read more about this in my "blog post":http://www.tripleboot.org/?p=138 scroll down to "msvc2012_opengl".
Regardless, I still have the same error even after following your blog post (I posted a comment regarding that on your blog some time earlier).
In your blog you write,
"This deployment is almost the same as the non-OpenGL versions above, but actually easier since there is no libEGL.dll and libGLESv2.dll dependencies."
Yet I get this when using msvc2012_opengl with no libGLESv2.dll in the directory of the file:
I reinstalled Qt and corrected all the kit's compilers and Qt's. Using Microsoft Visual C++ Compiler 12.0 (x86) and Qt 5.3.0 (msvc2013) I was able to solve the error. However now the program crashes when run. While it runs within Qt, it still shows a crash error in the application output:
"The instruction at 0x5b175f0d referenced memory at 0x00000000. The memory could not be read.
Click on OK to terminate the program"
Edit: Qt shows this:
"QWindowsWindow::setGeometry: Unable to set geometry 75x23+480+190 on QWidgetWindow/'QPushButtonClassWindow'. Resulting geometry: 124x23+480+190 (frame: 8, 31, 8, 8, custom margin: 0, 0, 0, 0, minimum size: 0x0, maximum size: 16777215x16777215).
Problem creating accessible interface for: QPushButton(0x88fd18)
Make sure to deploy Qt with accessibility plugins."
After adding the "Accessible" folder from the plugins directory the program works fine in Qt. It still crashes when not running from Qt, however.
I rebuilt the debug version of the application and it still shows the platform error. I have no idea why the debug and release versions are showing different results.
[quote author="abraker95" date="1402618312"]And no it doesn’t work in Qt.[/quote]If it doesn't work in Qt Creator, then it won't work when you try to deploy it. You need to get it to work in Qt Creator first.
By the way, "Qt" is the name of the library. "Qt Creator" is the name of the IDE that uses the Qt library.
[quote author="abraker95" date="1402618312"]The only DLL’s I copied from the mingw48_32 folder is the platform since it’s the only qWindows.dll I found. The rest of the DLL’s come from the msvc2012_opengl folder...[/quote]You must not mix DLLs. Only take from the folder that matches your compiler. DLLs that don't match your compiler will break your program.
[quote author="abraker95" date="1402618312"]Yet I get this when using msvc2012_opengl with no libGLESv2.dll in the directory of the file[/quote]I'm guessing this happened because you copied the MinGW DLLs (which DO need libEGL.dll/libGLESv2.dll), and Qt tried to load the non-OpenGL DLLs. Like I said before, don't mix.
[quote author="abraker95" date="1402618312"]Qt shows this:
“QWindowsWindow::setGeometry: Unable to set geometry 75×23+480+190 on QWidgetWindow/‘QPushButtonClassWindow’. Resulting geometry: 124×23+480+190 (frame: 8, 31, 8, 8, custom margin: 0, 0, 0, 0, minimum size: 0×0, maximum size: 16777215×16777215).[/quote]This message is safe and doesn't cause crashes. It appeared because you didn't specify a size for the QPushButton.
[quote]Problem creating accessible interface for: QPushButton(0×88fd18)
Make sure to deploy Qt with accessibility plugins.”[/quote]This message is safe and doesn't cause crashes. It won't stop your program from running.
Anyway, I recommend:
Uninstall the versions of Qt that you don't need. Only keep the one that matches your compiler.
Remove Qt from your PATH (if you put it there before)
Remove MinGW from your PATH (if you put it there before)
Delete the build-Hello_World-Desktop-Release folder
Start a new project using the Qt Creator wizard: File -> New File or Project... -> Applications -> Qt Widgets Application
[quote author="abraker95" date="1402618312"]
After adding the "Accessible" folder from the plugins directory the program works fine in Qt. It still crashes when not running from Qt, however.[/quote]That doesn't sound right. If you click the "Run" button, Qt Creator will find the DLLs automatically. You shouldn't need to copy anything.
Where did you copy the folder into?
After you follow the steps in my previous post, please post a screenshot of Tools -> Options -> Build & Run -> Kits
I copied the folder to where the application is.
Hi, I see on your computer, MinGW and Visual Studio are both installed, this will invariably lead to problems. I think, if you want to have 2 different compilers, you need to have 2 different computers.
@abraker95: I'm surprised that you don't have anything auto-detected. How did you install Qt? What packages did you download?
[quote author="hskoglund" date="1402630458"]Hi, I see on your computer, MinGW and Visual Studio are both installed, this will invariably lead to problems. I think, if you want to have 2 different compilers, you need to have 2 different computers. [/quote]That in itself isn't an issue. I have Qt for both MinGW and MSVC 2013 on my computer; they can coexist just fine.
However, abraker95 has done manual configuration for his kits, so they might not have been set up correctly. That why I recommended removing Qt and MinGW from the PATH, and uninstalling unneeded copies.
I finally got both the debug and release versions of the applications working from Qt and from the folders when the appropriate DLL's are copied. However, as you have said, Qt doesn't want to auto-detect anything.
These are the environment variables I found relating to Qt in the projects tab on the left:
I found no environment variables relating to MingW (I do have it installed, though). More confusing, why doesn't the application run from Qt when clearly the path to the Qt version is set without the copied DLL's?
I finally solved that problem too!
Thank this thread: "Fix":http://qt-project.org/forums/viewthread/29372
So to get the application to be run from Qt without copying DLL's over, you will have to add an environment variable to the project's settings. Note that I'm using msvc2013 in this example, so replace that with what you are using. Here are the baby steps on doing this:
- Head over to the projects tab on the left
- On the top you will see the kit(s) you are using to build the project with. Click on run (which is right next to "build"). This will bring you to a similar, yet a little different page.
- Scroll down until you see Run Environment
- Click on details on the right to expand the section
- Click on the add button on right
- Type or Copy/Paste QT_QPA_PLATFORM_PLUGIN_PATH as the variable name on the lest column.
- In the right column, type in the directory in which you platform is in. In my case, it is "C:\Qt\5.3\msvc2013\plugins\platforms".
- Run the project
Edit: For step 7, "$(QTDIR)\plugins\platforms" should be able to automatically point to the needed directory. Thank this thread: "link":http://qt-project.org/forums/viewthread/26001
If you are getting any errors relating to DLL's or something like so:
"The instruction at 0×5b175f0d referenced memory at 0×00000000. The memory could not be read.
Click on OK to terminate the program"
Then you probably don't have an environment variable pointing to the bin directory of the compiler you are using.
I wish the process would have been simpler. hskoglund, perhaps you might include this in your blog as well?
Hi, it's in "my blog":http://www.tripleboot.org/?p=536 (scroll down to bonus contents) but I had a spelling error: -QT_QPA_PLUGIN_PATH- fixed now.
Good it worked for you, but using QT_ QPA_PLATFORM_PLUGIN_PATH I think has 2 disadvantages:
- If your app depends on other plugins/subdirectories, for example imageformats or sqldrivers, then this environment variable has no effect
- if you deploy your app to another computer then you must remember to set the environment variable on that computer as well.
I wonder why the IDE doesn't set the platform directory by default.
It does when you install Qt, the installer writes the plugin path into Qt5Core.dll and qmake.exe.
hskoglund - that last comment really helped me out! I was changing Qt versions, copied my DLLs (including Qt5Cored.dll) to the deployment target location. After a while I needed to reinstall the Qt version and I didn't have a clue why it wouldn't work - until I read your comment about the installer's change.
I have also had headakes with my app which worked in Qt Creator and on my computer but not on other computer.
The problem was that I was not using the correct qwindows.dll. I used the version from P:\Qt\Qt5.1.1-mingw\Tools\QtCreator\bin\plugins\platforms.
The correct version is in P:\Qt\Qt5.1.1-mingw\5.1.1\mingw48_32\plugins\platforms
As hskoglund said, you should'n probably use dlls from qtcreator folder.