This application failed to start because the Qt platform plugin "Windows" could not be found or loaded error message


Lion King

Qt v5.3.1I'm using MinGW v4.8.2it in an app I've created windows 7 32bit.
I get the following error when opening my app:

I have included all the important files to use the windeployqt.exetools to run my application .

This platformsfolder also contains:

Also, I included all the important files and ran my app manually without using windeployqt.exetools , but the problem persists.

I don't know how to solve this problem.


edit

The result of using the Dependency Walkertool .

I'm still don't know how to get these dll files question mark.

Lion King

Firstly, thank everyone for contributing to the understanding of the problem and how to solve it.

Now, to solve this problem you must read this article Accurately, in order to understand first what is the problem, and then how to solve it. [Deploying a real Qt app – understanding more of Qt]

The conclusion In short :
the reason of the problem is the path of the plugins that you used in your project.
The default path to plugins that you used in your project is qt path folder, but when qt development environment not be installed on your machine, your application will not run, because the default path to plugins directed to qt path folder, and this is the problem.
We need to direct/change the plugins path to your application folder.

There are several ways to direct/change the path. I will mention the way in which I have already tried and succeeded in solving the problem

There is a static method named addLibraryPath(const QString & path), this method We will use it to direct/change the plugins path.

Example:

int main(int argc, char *argv[])
{
    QApplication::addLibraryPath("pluginsFolder");
    QApplication a(argc, argv);
    Widget w;
    w.show();


    return a.exec();
}

pluginsFolderis the folder that contain all plugins that you used in your project.

You can also change

QApplication::addLibraryPath("pluginsFolder");

To

QApplication::addLibraryPath(".");

This means that the plugins in the main application folder not in subdirectory named plugins.
And don't forget to use windeployqt.exe tool to deploy your project.

And finally, I hope that this the short explanation will be useful for those after me, who will face the same problem.

Related


The platform plugin 'Windows' could not be found or loaded

OnArap I am trying to make an installer for my QtCreator project It works fine on my computer, but when I try to install it elsewhere it shows me the following message This application failed to start because the Qt platform plugin 'windows' could not be found

The platform plugin 'Windows' could not be found or loaded

OnArap I am trying to make an installer for my QtCreator project It works fine on my computer, but when I try to install it elsewhere it shows me the following message This application failed to start because the Qt platform plugin 'windows' could not be found