相关疑难解决方法(0)

不能在QtCreator中使用g ++ 7.2使用c ++ 17功能

我最近将gcc和g ++更新到版本7.2.我想尝试一下std::experimental::any,std::variant特别是,我在QtCreator中使用Qt 5.9.1.

到目前为止,我已经在项目文件中写了这个:

CONFIG += c++17
Run Code Online (Sandbox Code Playgroud)

我在正确的位置添加了正确的标题:

#include <variant>
#include <experimental/any>
Run Code Online (Sandbox Code Playgroud)

任何工作都很好,没有问题.但是,当我包含变体头文件时,我收到此错误:

/usr/include/c++/7/bits/c++17_warning.h:32: error: #error This file requires compiler and library support for the ISO C++ 2017 standard. This support must be enabled with the -std=c++17 or -std=gnu++17 compiler options.
Run Code Online (Sandbox Code Playgroud)

#error此文件需要编译器和库支持\ ^ ~~~~

我在项目文件中尝试过各种各样的东西,这里是完整列表:

CONFIG += c++17
Run Code Online (Sandbox Code Playgroud)

&

CONFIG += c++1z
Run Code Online (Sandbox Code Playgroud)

&

QMAKE_CXXFLAGS += -std=c++17
Run Code Online (Sandbox Code Playgroud)

&

QMAKE_CXXFLAGS += -std=c++1z
Run Code Online (Sandbox Code Playgroud)

&

CONFIG += c++17
QMAKE_CXXFLAGS += -std=c++17
Run Code Online (Sandbox Code Playgroud)

&

CONFIG += c++1z
QMAKE_CXXFLAGS += -std=c++1z
Run Code Online (Sandbox Code Playgroud)

&

CONFIG …
Run Code Online (Sandbox Code Playgroud)

c++ variant qt-creator c++17

22
推荐指数
2
解决办法
2万
查看次数

标签 统计

c++ ×1

c++17 ×1

qt-creator ×1

variant ×1