相关疑难解决方法(0)

如何使用带有-std = c ++ 17的g ++ 6.2.0包含C++ 17头文件(可选,任何,string_view,variant)

std::optional在C++ 17中,它在std::experimental::optional以前.

我尝试<optional>使用以下命令编译包含的文件:

g++ -std=c++17 <filename>.cpp
Run Code Online (Sandbox Code Playgroud)

(在Bash终端).我收到以下错误:

<filename>.cpp:5:20 fatal error: optional: No such file or directory
 #include <optional>
                    ^
compilation terminated
Run Code Online (Sandbox Code Playgroud)

但我可以#include <experimental/optional>.

我错过了一些头文件吗?我怎样才能包含optional标题?

我也不能包括<any>,<string_view>或者<variant>,得到相同的错误.

c++ g++ include header-files c++17

6
推荐指数
1
解决办法
3416
查看次数

标签 统计

c++ ×1

c++17 ×1

g++ ×1

header-files ×1

include ×1