QT creator qt6.0 使用msvc2019 64bit编译报错

qt creator qt6.0报错:

D:\Qt6\6.3.0\msvc2019_64\include\QtCore\qglobal.h:123: error: C1189: #error: "Qt requires a C++17 compiler, and a suitable value for __cplusplus. On MSVC, you must pass the /Zc:__cplusplus option to the compiler."

pro文件添加:QMAKE_CXXFLAGS += -std:c++17 -Zc:__cplusplus -permissive- option

//:-1: error: dependent '..\..\..\..\Qt6\6.3.0\msvc2019_64\include\QtWidgets\QMainWindow' does not exist.

pro文件添加:(这个语法将使makefile包含绝对路径)

QMAKE_PROJECT_DEPTH = 0

QT creator显示信息:

mainwindow.h:10:10: In included file: STL1001: Unexpected compiler version, expected MSVC 19.29 or newer.

不影响编译,可忽略

vs2019参考解决方法:

错误 C1189 #error: STL1001: Unexpected compiler version, expected MSVC 19.22 or newer.

出现问题的原因

通过网络查找社区,看个方面资料,终于定位到问题所在:

#define _MSC_VER 1500

由于这句宏定义要求的mscv版本为15.00版本,而我使用的visual studio 2019 (社区版)使用的mscv版本为19.22,两者版本不对应,导致编译的时候出现编译器版本的报错

解决方案

直接修改这句宏定义为自己使用visual studio的mscv对应版本即可成功编译通过。

#define _MSC_VER 1922

相关推荐
xrgs_shz7 分钟前
MATLAB的数据类型和各类数据类型转化示例
开发语言·数据结构·matlab
来恩10033 小时前
C# 类与对象详解
开发语言·c#
komo莫莫da4 小时前
寒假刷题Day19
java·开发语言
ElseWhereR4 小时前
C++ 写一个简单的加减法计算器
开发语言·c++·算法
※DX3906※5 小时前
cpp实战项目—string类的模拟实现
开发语言·c++
wjs20245 小时前
Nginx 安装配置指南
开发语言
美味小鱼5 小时前
实践Rust:编写一个猜数字游戏
开发语言·游戏·rust
Dr.勿忘6 小时前
C#面试常考随笔8:using关键字有哪些用法?
开发语言·unity·面试·c#·游戏引擎
dal118网工任子仪6 小时前
92,[8] 攻防世界 web Web_php_wrong_nginx_config
开发语言·php
wjs20246 小时前
SQLite Update 语句详解
开发语言