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

相关推荐
格林威2 小时前
Baumer工业相机堡盟工业相机的工业视觉中为什么偏爱“黑白相机”
开发语言·c++·人工智能·数码相机·计算机视觉
橙子199110162 小时前
在 Kotlin 中什么是委托属性,简要说说其使用场景和原理
android·开发语言·kotlin
androidwork2 小时前
Kotlin Android LeakCanary内存泄漏检测实战
android·开发语言·kotlin
学地理的小胖砸2 小时前
【Python 基础语法】
开发语言·python
DanB244 小时前
Java笔记4
java·开发语言·笔记
Dddle14 小时前
C++:this指针
java·c语言·开发语言·c++
studyer_domi4 小时前
Matlab 234-锂电池充放电仿真
开发语言·matlab
伐尘4 小时前
【Qt】编译 Qt 5.15.x For Windows 基础教程 Visual Studio 2019 MSVC142 x64
windows·qt·visual studio
yuanpan4 小时前
.net/C#进程间通信技术方案总结
开发语言·c#·.net
吃面不喝汤664 小时前
破解 Qt QProcess 在 Release 模式下的“卡死”之谜
开发语言·qt