问题描述
我正在尝试在带有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:
因此,我改为尝试编译一个简单的项目(直接的QtWidgetsApplication模板),它为我提供了这一点:
So instead, I tried to compile a simple project (the direct QtWidgetsApplication template) and it gave me this:
我已经寻找解决方案已有一段时间了,但是我没有找到明确的答案.
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平台插件"的问题.问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!