This application failed to start because no Qt platform plugin could be initialsed.
-
This seems to be a common problem for many years with no satisfactory solutions given by any of the posts I have encountered, and many a suggestion that just simply do not work.
After copying the required dll that trying to execute a complied QT .exe file requests it needs to run , this dreaded message appears suggesting the application needs to be reinstalled. Well after uninstalling and reinstalling QT three times with different versions after I decided to upgrade to 5.15.0 and ending up with 5.15 in the past three days, and had no better result, my mood, is not all that jolly.
However, one past post I encountered gave me a clue by suggesting to include an unrelated .dll file. Well copying that dll file did not work. But copying my Qt exe file into the Qt bin directory where all of the Qt dll files did!
There seems that to run a resultant compiled Qt .exe function, it needs more than just the .dll files indicated as missing, and since there are so many dll and other files in the Qt bin directory, it will be difficult to find which one(s) are needed. I cannot find any documentation or posts to indicate what files beyond the missing dll files a Qt .exe file indicates is missing are required.
So I ask, does anyone know which files in the Qt bin directory needs to be copied into the directory in which a compiled Qt .exe file resides to get it running. I do not like using the run button as I develop my code as it can cause problems with Visual Studio or Qt creator.
Thanks in advance if any one can answer this.
Much appreciated.
-
https://doc.qt.io/qt-5/windows-deployment.html
You need to place some dlls in specific places alongside with your application. Ensure that the folders for those dll are correect.
An information recommending to reinstall does not refer to your complete Qt lib installation but to your application and the required dlls.
-
Thanks koahnig, I read that URL more closely and found the solution before I came back here and read your post.
What needs to be done is to copy the QT directory "platforms" found in the QT plugins directory to the location where the resultant compilation exe file resides.
What confused and mislead me was that copying the compiled exe file to the QT bin directory ran without complaining. I have not yet deployed an application so it was not until yesterday I had payed attention to this documentation. Before upgrading to 5.15.1, I could run the executables without a problem with no need for dlls or other files to be present in the directory as it seemed a QTDIR environmental variable set to the Qt directory did this for me. That now for some reason, no longer has the same effect.
Thanks for the advice, if I had not discovered the solution myself, it would have helped me.
All the best.
-
Using fixed environment settings is no longer a good idea especially when using Qt creator. Qt creator allows switching between different tool chains and versions of Qt libs from compilation to compilation. However using fixed environment settings messes up this capability.
The plugin stuff was introduced a while ago with Qt5. So it is nothing new with Qt5.15.1.