[CMake]报错: Qt requires a C++17 compiler

1.报错:

#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."

2.解决

Qt5项目升级到Qt6项目,cmake需要做兼并配置;

复制代码
# 设置c++标准为17 需设置在 project 之前
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
 
# 增加编译选项
add_compile_options("/permissive-")
add_compile_options("/Zc:__cplusplus")

3.来源

cmake 项目。qt5升级 qt6 报错 error: "Qt requires a C++17 compiler 已解决_#error "qt requires a c++17 compiler-CSDN博客

相关推荐
念恒123061 天前
继承(下) (Inheritance)
c++
H Journey1 天前
C++之 CMake、CMakeLists.txt、Makefile
开发语言·c++·makefile·cmake
研究点啥好呢1 天前
Github热门项目推荐 | 创建你的像素风格!
c++·python·node.js·github·开源软件
_dindong1 天前
cf1091div2 C.Grid Covering(数论)
c++·算法
沫璃染墨1 天前
C++ string 从入门到精通:构造、迭代器、容量接口全解析
c语言·开发语言·c++
6Hzlia1 天前
【Hot 100 刷题计划】 LeetCode 17. 电话号码的字母组合 | C++ 回溯算法经典模板
c++·算法·leetcode
计算机安禾1 天前
【数据结构与算法】第36篇:排序大总结:稳定性、时间复杂度与适用场景
c语言·数据结构·c++·算法·链表·线性回归·visual studio
unicrom_深圳市由你创科技1 天前
做虚拟示波器这种实时波形显示的上位机,用什么语言?
c++·python·c#
无限进步_1 天前
【C++】电话号码的字母组合:从有限处理到通用解法
开发语言·c++·ide·windows·git·github·visual studio
C++ 老炮儿的技术栈1 天前
GCC编译时无法向/tmp 目录写入临时汇编文件,因为设备空间不足,解决
linux·运维·开发语言·汇编·c++·git·qt