如何解决“不能初始化Qt平台插件"的问题.问题? [英] How to solve the "no Qt platform plugin could be initialized" problem?

查看:2264
本文介绍了如何解决“不能初始化Qt平台插件"的问题.问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在带有Qt扩展名的Visual Studio上的 release 模式下运行一个简单的模板.到目前为止,我一直在以调试模式运行项目(从未遇到过麻烦).最近,我从一个使用 webengine 小部件的浏览器应用程序开始,但是在调试模式下它非常慢.在继续之前,我想确保可以以更高的性能(在发布模式下)运行.

I'm trying to run a simple template in release mode on Visual Studio with the Qt extension. So far I've always been running projects in debug mode (never had trouble). Recently, I started with a browser application using webengine its widgets, but it's very slow on debug mode, so. I wanted to make sure it's possible to run with higher performance (on release mode), before continuing.

我很惊讶,因为在尝试运行该应用程序后,该应用程序相互抛出了4条错误消息弹出窗口:

I was surprised, because the application throws 4 error message pop-ups after each other after trying to run it:

过程入口点?endl @ QTextStreamFunctions @@ YAAEAVQTextStream @@ AEAV2 @@ Z不在动态链接库C:\ Qt \ 5.14.1 \ msvc2017_64 \ bin \ Qt5WebChannel.dll中.

The procedure entry point ?endl@QTextStreamFunctions@@YAAEAVQTextStream@@AEAV2@@Z could not be located in the dynamic link library C:\Qt\5.14.1\msvc2017_64\bin\Qt5WebChannel.dll.

  • 过程入口点argToQString @ QQtPrivate ... QString ... QStringView ...不在动态链接库C:\ Qt \ 5.14.1 \ msvc2017_64 \ bin \ Qt5WebChannel.dll中.

    The procedure entry point ?argToQString@QQtPrivate...QString...QStringView... could not be located in the dynamic link library C:\Qt\5.14.1\msvc2017_64\bin\Qt5WebChannel.dll.

  • 还有两个类似的 QDebug QRhiDepthStencilClearValue

  • 因此,我改为尝试编译一个简单的项目(直接的QtWidgetsApplication模板),它为我提供了这一点:

    So instead, I tried to compile a simple project (the direct QtWidgetsApplication template) and it gave me this:

    此应用程序无法启动,因为没有Qt Platform插件可以被初始化.重新安装该应用程序可能会解决此问题.

    我已经寻找解决方案已有一段时间了,但是我没有找到明确的答案.

    I've been looking for a solution for quite some time now, but I didn't find a clear answer.

    我的目录: C:\ Qt \ 5.14.1 \ msvc2017_64

    我的模板代码:

    #include "QtWidgetsApplication2.h"
    #include <QtWidgets/QApplication>
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        QtWidgetsApplication2 w;
        w.show();
        return a.exec();
    }
    

    #pragma once
    
    #include <QtWidgets/QMainWindow>
    #include "ui_QtWidgetsApplication2.h"
    
    class QtWidgetsApplication2 : public QMainWindow
    {
        Q_OBJECT
    
    public:
        QtWidgetsApplication2(QWidget *parent = Q_NULLPTR);
    
    private:
        Ui::QtWidgetsApplication2Class ui;
    };
    

    #include "QtWidgetsApplication2.h"
    
    QtWidgetsApplication2::QtWidgetsApplication2(QWidget *parent)
        : QMainWindow(parent)
    {
        ui.setupUi(this);
    }
    

    我不知道如何解决此问题.你能帮我吗?预先感谢!

    I have no clue of how to fix this problem. Could you please help me out? Thanks in advance!

    推荐答案

    查看是否您是否要通过双击.exe来启动程序?我试图重现它:

    Are you trying to start the program by double clicking the .exe ? I tried to reproduce it:

    • 在发布模式下构建一个简单的项目
    • 运行 windeployqt ... 并删除生成的文件夹 ./platforms
    • 双击.exe来运行它.

    ,并提示您收到错误消息.

    and prompts the error message you got.

    这篇关于如何解决“不能初始化Qt平台插件"的问题.问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆