Почему произошла эта ошибка?сборка библиотеки c ++ - PullRequest
0 голосов
/ 17 декабря 2018

Я не знаю, почему возникает эта ошибка.

Я использую nghttp2 для centos 7.

Мой centos поддерживает c ++ 17

Я забылЛюбые варианты?

Помогите мне, пожалуйста.

Спасибо.


    <b>usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2:</b> <b>error: </b>#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.
     #error This file requires compiler and library support for the \
    <b>  ^</b>
    In file included from <b>util.h:52:0</b>,
                     from <b>util.cc:25</b>:
    <b>template.h:44:19:</b> <b>warning: </b>variadic templates only available with -std=c++11 or -std=gnu++11 [enabled by default]
     template <typename... T>
    <b>                   ^</b>
    <b>template.h:45:1:</b> <b>error: </b>‘<b>constexpr</b>’ does not name a type
     constexpr std::array<
    <b> ^</b>
    <b>template.h:45:1:</b> <b>note: </b>C++11 ‘<b>constexpr</b>’ only available with -std=c++11 or -std=gnu++11
    <b>template.h:54:33:</b> <b>error: </b>‘<b>constexpr</b>’ does not name a type
     template <typename T, size_t N> constexpr size_t array_size(T (&)[N]) {
    <b>                                 ^</b>
    <b>template.h:54:33:</b> <b>note: </b>C++11 ‘<b>constexpr</b>’ only available with -std=c++11 or -std=gnu++11
    <b>template.h:58:33:</b> <b>error: </b>‘<b>constexpr</b>’ does not name a type
     template <typename T, size_t N> constexpr size_t str_size(T (&)[N]) {
    <b>                                 ^</b>
    <b>template.h:58:33:</b> <b>note: </b>C++11 ‘<b>constexpr</b>’ only available with -std=c++11 or -std=gnu++11
    <b>template.h:64:31:</b> <b>warning: </b>variadic templates only available with -std=c++11 or -std=gnu++11 [enabled by default]
     template <typename F, typename... T> struct Defer {
    <b>                               ^</b>
    <b>template.h:65:11:</b> <b>error: </b>expected ‘<b>,</b>’ or ‘<b>...</b>’ before ‘<b>&&</b>’ token
       Defer(F &&f, T &&... t)
    <b>           ^</b>
    <b>template.h:67:15:</b> <b>error: </b>expected ‘<b>,</b>’ or ‘<b>...</b>’ before ‘<b>&&</b>’ token
       Defer(Defer &&o) noexcept : f(std::move(o.f)) {}
    <b>               ^</b>
    <b>template.h:67:18:</b> <b>error: </b>invalid constructor; you probably meant ‘<b>nghttp2::Defer<F, T> (const nghttp2::Defer<F, T>&)</b>’
       Defer(Defer &&o) noexcept : f(std::move(o.f)) {}
    <b>                  ^</b>
    <b>template.h:67:18:</b> <b>error: </b>expected ‘<b>;</b>’ at end of member declaration
    <b>template.h:67:20:</b> <b>error: </b>‘<b>noexcept</b>’ does not name a type
       Defer(Defer &&o) noexcept : f(std::move(o.f)) {}
    <b>                    ^</b>
    <b>template.h:70:9:</b> <b>error: </b>expected nested-name-specifier before ‘<b>ResultType</b>’
       using ResultType = typename std::result_of<typename std::decay<F>::type(
    <b>         ^</b>
    <b>template.h:70:9:</b> <b>error: </b>using-declaration for non-member at class scope
    <b>template.h:70:20:</b> <b>error: </b>expected ‘<b>;</b>’ before ‘<b>=</b>’ token
       using ResultType = typename std::result_of<typename std::decay<F>::type(
    <b>                    ^</b>
    <b>template.h:70:20:</b> <b>error: </b>expected unqualified-id before ‘<b>=</b>’ token
    <b>template.h:72:3:</b> <b>error: </b>‘<b>function</b>’ in namespace ‘<b>std</b>’ does not name a type
       std::function<ResultType()> f;
    <b>   ^</b>
    <b>template.h:</b> In constructor ‘<b>nghttp2::Defer<F, T>::Defer(F)</b>’:
    <b>template.h:66:9:</b> <b>error: </b>class ‘<b>nghttp2::Defer<F, T></b>’ does not have any field named ‘<b>f</b>’
           : f(std::bind(std::forward<F>(f), std::forward<T>(t)...)) {}
    <b>         ^</b>
    <b>template.h:66:11:</b> <b>error: </b>‘<b>bind</b>’ is not a member of ‘<b>std</b>’
           : f(std::bind(std::forward<F>(f), std::forward<T>(t)...)) {}
    <b>           ^</b>
    <b>template.h:66:11:</b> <b>note: </b>suggested alternative:
    In file included from <b>/usr/include/netinet/in.h:24:0</b>,
                     from <b>/usr/include/netdb.h:27</b>,
                     from <b>util.h:35</b>,
                     from <b>util.cc:25</b>:
    ...

1 Ответ

0 голосов
/ 17 декабря 2018

я забыл какие-либо параметры?

Вы сделали, и компилятор скажет вам, что именно:

error: #error Этот файл требует поддержки компилятора и библиотекидля стандарта ISO C ++ 2011.Эта поддержка в настоящее время является экспериментальной, и должен быть включен с опциями компилятора -std = c ++ 11 или -std = gnu ++ 11 .


Вывозможно, используется действительно старый компилятор (тот, который поставляется с CentOS по умолчанию).

Вам необходимо установить Red Hat Developer Toolset, который предоставляет обновленные версии, подробнее см. https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/:

Developer Toolset предназначен для разработчиков, работающих на платформе CentOS или Red Hat Enterprise Linux.Он предоставляет текущие версии GNU Compiler Collection, GNU Debugger и другие инструменты разработки, отладки и мониторинга производительности.

...