Qt运行生成的exe报错“This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.”
Qt运行生成的exe报错
“This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.”
报错复现
将exe复制一份至单独文件夹中,直接运行会发现报错缺少一些dll
去Qt根目录D:\QT\Qt\5.15.0\mingw81_64\bin
中找到对应缺少的dll并复制到文件夹中
补充dll完成后运行发现还是报错
解决方法
此时,去Qt根目录bin的上一级目录找到plugins目录:D:\QT\Qt\5.15.0\mingw81_64\plugins
找到其中的platforms
文件夹直接复制过来即可解决
补充:
platforms
文件夹中很多部分是不需要,只需要留下qwindows.dll
即可。
** 这个dll不能直接放外面,必须保证exe文件同级目录下有一个platforms
文件夹,且文件夹下有一个qwindows.dll
文件**。