为什么会出现这个错误? C ++库构建

Why did this error occur? c++ library build

我不知道为什么会出现这个错误。

我在 centos 7 上使用 nghttp2。

我的centos支持c++17

我是不是忘记了任何选项?

请帮帮我。

谢谢。


    usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: 错误:#error 此文件需要编译器和库支持 ISO C++ 2011 标准。此支持目前处于试验阶段,必须使用 -std=c++11 或 -std=gnu++11 编译器选项启用。
     #error 此文件需要编译器和库支持 \
    ^util.h:52:0 包含的文件中,
                     来自 util.cc:25:
    template.h:44:19: 警告:可变参数模板仅适用于 -std=c++11 或 -std=gnu+ +11 [默认启用]
     模板 <类型名... T>
    ^
    template.h:45:1: error: constexpr’没有命名类型
     constexpr std::array<
    ^
    template.h:45:1: 注意:仅 C++11 'constexpr'可用于 -std=c++11 或 -std=gnu++11
    template.h:54:33: error: constexpr’没有命名类型
     template  constexpr size_t array_size(T (&)[N]) {
    ^
    template.h:54:33: 注意:仅 C++11 'constexpr'可用于 -std=c++11 或 -std=gnu++11
    template.h:58:33: error: constexpr’ does not name a type
     template  constexpr size_t str_size(T (&)[N]) {
    ^
    template.h:58:33: 注意:仅 C++11 'constexpr'可用于 -std=c++11 或 -std=gnu++11
    template.h:64:31: 警告:可变参数模板仅适用于 -std=c++11 或 -std=gnu+ +11 [默认启用]
     模板  struct Defer {
    ^
    template.h:65:11: 错误:预期','或'...' 在 '&&' 标记之前
       推迟(F &&f,T &&... t)
    ^
    template.h:67:15: 错误:预期','或'...' 在 '&&' 标记之前
       推迟(推迟 &&o)除了:f(std::move(o.f)){}
    ^
    template.h:67:18: 错误:构造函数无效;你的意思可能是‘nghttp2::Defer (const nghttp2::Defer&)”
       推迟(推迟 &&o)除了:f(std::move(o.f)){}
    ^
    template.h:67:18: error: expected ';' at the end of member宣言
    template.h:67:20: error: noexcept’没有命名类型
       推迟(推迟 &&o)除了:f(std::move(o.f)){}
    ^
    template.h:70:9: 错误:预期在'ResultType[=115=之前嵌套名称说明符]'
       使用 ResultType = typename std::result_of::type(
    ^
    template.h:70:9: 错误:非成员在 class 范围内使用声明
    template.h:70:20: error: expected ';' before '=' 令牌
       使用 ResultType = typename std::result_of::type(
    ^
    template.h:70:20: 错误:'=' 之前的预期不合格 ID令牌
    template.h:72:3: 错误: 'function' in namespace 'std' 没有命名一个类型
       std::function f;
    ^
    template.h: 在构造函数‘nghttp2::Defer::Defer(F)’中:
    template.h:66:9: 错误:class 'nghttp2::Defer' 没有任何名为 'f' 的字段
           : f(std::bind(std::forward(f), std::forward(t)...)) {}
    ^
    template.h:66:11: error: 'bind' 不是'标准'
           : f(std::bind(std::forward(f), std::forward(t)...)) {}
    ^
    template.h:66:11: 注意:建议的替代方案:
    在 /usr/include/netinet/in.h:24:0 包含的文件中,
                     来自 /usr/include/netdb.h:27,
                     来自 util.h:35,
                     来自 util.cc:25:
    ...

i forgot any options?

你做到了,编译器准确地告诉你:

error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.


您可能正在使用一个非常古老的编译器(默认情况下 CentOS 附带的编译器)。

您需要安装提供最新版本的 Red Hat Developer Toolset,有关详细信息,请参阅 https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/

Developer Toolset is designed for developers working on CentOS or Red Hat Enterprise Linux platform. It provides current versions of the GNU Compiler Collection, GNU Debugger, and other development, debugging, and performance monitoring tools.