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

相关推荐
Cao12345678932117 分钟前
扫雷-C语言版
c语言·开发语言
天堂的恶魔94628 分钟前
QT —— 信号和槽(槽函数)
开发语言·qt
水w34 分钟前
【Python爬虫】详细入门指南
开发语言·爬虫·python·scrapy·beautifulsoup
XXYBMOOO40 分钟前
基于 Qt 的 BMP 图像数据存取至 SQLite 数据库的实现
数据库·c++·qt
Susea&1 小时前
数据结构初阶:双向链表
c语言·开发语言·数据结构
pianmian12 小时前
arcgis几何与游标(1)
开发语言·python
-曾牛2 小时前
【LangChain4j快速入门】5分钟用Java玩转GPT-4o-mini,Spring Boot整合实战!| 附源码
java·开发语言·人工智能·spring boot·ai·chatgpt
nanzhuhe2 小时前
python中参数前**的含义
开发语言·python
wt_cs2 小时前
身份认证C#集成方案-数字时代身份证实名认证利器
开发语言·c#
ghost1433 小时前
Python自学第2天:条件语句,循环语句
开发语言·python·学习