我以创建的应用程序Qt v5.3.1
使用MinGW v4.8.2
上windows 7 32bit
。
打开我的应用程序时出现以下错误:
我已经包含了所有重要文件,以使用windeployqt.exe
工具来运行我的应用程序。
该platforms
文件夹还包含:
另外,我包含了所有重要文件,无需使用windeployqt.exe
工具即可手动运行我的应用程序,但问题仍然存在。
我不知道如何解决这个问题。
编辑
使用Dependency Walker
工具的结果。
I'm still don't know how to get these dll files question mark
.
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();
}
pluginsFolder
is 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.
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句