【问题标题】:Why did this error occur? c++ library build为什么会出现这个错误? c++ 库构建
【发布时间】:2019-05-18 01:30:32
【问题描述】:

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

我在 centos 7 上使用 nghttp2。

我的centos支持c++17

我是否忘记了任何选项?

请帮帮我。

谢谢。

usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error 此文件需要编译器和库支持ISO C++ 2011 标准。此支持目前是实验性的,必须使用 -std=c++11 或 -std=gnu++11 编译器选项启用。 #error 此文件需要编译器和库支持 \ ^util.h:52:0 包含的文件中, 来自 util.cc:25template.h:44:19: 警告:可变参数模板仅适用于 -std=c++11 或 -std=gnu++11 [默认启用] 模板 ^ template.h:45:1: error: constexpr’没有命名类型 constexpr std::array ^ template.h:45:1: 注意:C++11 'constexpr' 仅适用于 -std=c++11 或 -标准=gnu++11 template.h:54:33: error: constexpr’没有命名类型 模板 constexpr size_t array_size(T (&)[N]) { ^ template.h:54:33: 注意:C++11 'constexpr' 仅适用于 -std=c++11 或 -标准=gnu++11 template.h:58:33: error: constexpr’没有命名类型 模板 constexpr size_t str_size(T (&)[N]) { ^ template.h:58:33: 注意:C++11 'constexpr' 仅适用于 -std=c++11 或 -标准=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: 错误:在 ' 之前应为 ',' 或 '...' &&' 令牌 Defer(Defer &&o) noexcept : f(std::move(o.f)) {} ^ template.h:67:18: 错误:无效的构造函数;你的意思可能是“nghttp2::Defer (const nghttp2::Defer&)' Defer(Defer &&o) noexcept : f(std::move(o.f)) {} ^ template.h:67:18: error: expected ‘;’ 在成员声明的末尾 template.h:67:20: error: noexcept’没有命名类型 Defer(Defer &&o) noexcept : f(std::move(o.f)) {} ^ template.h:70:9: 错误:ResultType”之前的预期嵌套名称说明符 使用 ResultType = typename std::result_of::type( ^ template.h:70:9: 错误:在类范围内为非成员使用声明 template.h:70:20: 错误:在“=”标记之前应为“;” 使用 ResultType = typename std::result_of::type( ^ template.h:70:20: error: expected unqualified-id before ‘=’ token template.h:72:3: error: 'function' in namespace 'std' 没有命名一个类型 std::function f; ^ template.h: 在构造函数“nghttp2::Defer::Defer(F)”中: template.h:66:9: 错误:类 'nghttp2::Defer' 没有任何名为 ' 的字段f' : f(std::bind(std::forward(f), std::forward(t)...)) {} ^ template.h:66:11: 错误:bind’不是‘std’的成员 : 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: ...

【问题讨论】:

    标签: c++ c++11 centos7 nghttp2


    【解决方案1】:

    我忘记了任何选项?

    你做到了,编译器会告诉你:

    错误:#error 此文件需要对 ISO C++ 2011 标准的编译器和库支持。此支持目前处于试验阶段,必须使用 -std=c++11 或 -std=gnu++11 编译器选项启用


    您可能正在使用一个非常旧的编译器(CentOS 默认自带的那个)。

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

    开发者工具集专为在 CentOS 或 Red Hat Enterprise Linux 平台上工作的开发者而设计。它提供了当前版本的 GNU 编译器集合、GNU 调试器以及其他开发、调试和性能监控工具。

    【讨论】:

      猜你喜欢
      • 2012-03-30
      • 1970-01-01
      • 1970-01-01
      • 2023-04-04
      • 2020-02-03
      • 1970-01-01
      • 1970-01-01
      • 2013-03-28
      相关资源
      最近更新 更多