简体   繁体   中英

How to solve the “no Qt platform plugin could be initialized” problem?

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.

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

  • 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.

  • 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.

  • Two more similar ones for QDebug and QRhiDepthStencilClearValue .

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

This application failed to start because no Qt Platform plugin could be initialized. Reinstalling the application may fix this problem.

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

My directory: C:\Qt\5.14.1\msvc2017_64

My template code:

#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!

See if this helps.

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

  • build a simple project in release mode
  • run windeployqt... and delete the generated folder ./platforms
  • double click on.exe to run it.

and prompts the error message you got.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM