Qt 运行时报错 This application failed to start because no Qt platform plugin could be initialized!

问题

运行时报错:
This application failed to start because no Qt platform plugin could be initialized!
如图:Qt 运行时报错 This application failed to start because no Qt platform plugin could be initialized!_第1张图片

描述:
代码没有问题,我换成其他构件就正常了。如 5.12.7

解决方案:

环境变量中加入:QT_PLUGIN_PATH
QT_PLUGIN_PATH=D:\Qt\Qt_SDK\5.12.6\msvc2017\plugins

我的方式是在Qt Creator 里面添加
即:项目 -> 编译(build) -> 环境变量-> 添加 (如图)
Qt 运行时报错 This application failed to start because no Qt platform plugin could be initialized!_第2张图片

你可能感兴趣的:(错误锦集,qt5)