C++编译Qt for Visual Studio 2017的问题
C++ compile problems with Qt for Visual Studio 2017
我已经安装了带有msvc2017_64二进制文件的Qt Creator。我还安装了VS2017的Qt插件。我可以毫无问题地创建一个QtGuiApplication,但是当我尝试编译它时,出现了许多错误。我在这里列出了它们,在 pastebin 上,因为我无法将这么多字符添加到 Stackoverflow 中。对此我很抱歉。
我需要任何必要的软件包吗?我为 VS2017 ofc 安装了C++。我还在Qt VS Tools菜单中加入了QtPath。
我没有编辑文件,因为项目创建和编译由于错误而失败。
编辑:这个问题在这里解决了。但是,不仅存在 Pastebin 形式的错误,QtGuiApplication.h中的错误也存在
。QtGuiApplication.h:(错误标记为注释(
#pragma once
#include <QtWidgets/QMainWindow>
#include "ui_QtGuiApplication1.h" //This could not be found
class QtGuiApplication1 : public QMainWindow
{
Q_OBJECT
public:
QtGuiApplication1(QWidget *parent = Q_NULLPTR);
private:
Ui::QtGuiApplication1Class ui; //Ui namespace does not exist
};
Qt应用.cpp:
#include "stdafx.h"
#include "QtGuiApplication1.h"
QtGuiApplication1::QtGuiApplication1(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
}
主.cpp:
#include "stdafx.h"
#include "QtGuiApplication1.h"
#include <QtWidgets/QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QtGuiApplication1 w;
w.show();
return a.exec();
}
我自己解决了这个问题!
Qt插件使用Windowns 8.1 SDK创建项目,您需要将其重新定位到Win 10 SDK才能从QtGuiApplication.h获取编译错误。即使安装了 8.1 SDK。似乎是一个错误。
解决方案对我来说非常简单,只需从解决方案资源管理器卸载然后重新加载解决方案! 这将清除所有 c++ 编译器错误!不知道为什么...
相关文章:
- 警告处理为错误这里有什么问题
- 最小硬币更换问题(自上而下方法)
- 为"adjacent"变量赋值时出现问题
- 我的神经网络不起作用 [XOR 问题]
- 在Ubuntu 16.04上安装Cilk时出现问题
- C++我的数学有什么问题,为什么我的代码不能正确循环
- Visual Studio 2017循环自动向量化问题
- 在Visual Studio 2017中使用c ++组件构建python解决方案时出现问题
- Visual Studio 2017 中的 cpprestapi 问题找不到 POST/GET 常量
- Visual Studio 2017 生成工具与枚举类型的问题
- C++编译Qt for Visual Studio 2017的问题
- Visual Studio 2017问题编译了C 代码,而该代码则在Linux中编译
- Boost 1.64 和 Visual Studio 2017 的问题
- 关于Visual Studio 2017中有关ConstexPR表达式的汇编问题
- Visual Studio 2017引起了问题
- 在Visual Studio 2017中连接NLOPT-2.4.2的问题
- VS 2017 C 静态LIB与 /MD项目依赖性问题编辑
- Visual Studio社区2017 Linker问题-Mariadb
- libtiff x64 visual studio 2017:链接器问题
- vs 2017 C 汇编问题