我一直在谷歌上寻找这个问题的解决方案,尽管我发现很多人分享我的问题,但他们的解决方案都不适合我。
我使用 Visual Studio 2010 使用 Qt 框架编写了一个 C++ 应用程序。我在 Visual Studio 的“发布”模式下构建并运行该应用程序没有问题,但是当我将该 exe 从发布文件夹复制到新目标时(假装它是一台新 PC ) 它无法运行,提供此错误:
---------------------------
TestApplication
---------------------------
This application failed to start because it could not find or load the Qt platform plugin "windows".
Available platform plugins are: windows.
Reinstalling the application may fix this problem.
在可执行目录中,我有以下文件结构:
./TestApplication.exe
./libGLESv2.dll
./Qt5Core.dll
./Qt5Gui.dll
./QtWidgets.dll
./platforms/qwindows.dll
./qt.conf
所有 dll 文件均取自库所在的 Qtbase 文件夹中的 Qt 5.0.0 版本。
qt.conf 文件是:
[Paths]
Plugins=.
没有它,启动错误是相同的,只是它说“最小”和“屏幕外”也是可用的平台。
对于遇到此错误的所有其他人,它似乎可以通过创建platforms
文件夹并放入 qwindows.dll 来解决。但我自己这样做并不会改变任何行为。
是不是我做错了什么?也许我首先生成 .exe 的方法是错误的?