Spdlogv v1.3.1 примеры асинхронного регистратора выдают ошибку в ubuntu 18.04

#c #ubuntu #asynchronous #boost-asio #spdlog

#c #ubuntu #асинхронный #boost-asio #spdlog’а

Вопрос:

Я установил spdlog вручную из репозитория git, имеющего версию 1.3.1 в version.h . Сейчас я пытаюсь выполнить базовые примеры, приведенные в репозитории, но они выдают определенные ошибки. Пример синхронных регистраторов, тем не менее, работает нормально.

Я попробовал 2 примера: создание асинхронного регистратора с помощью spdlogи асинхронный регистратор с несколькими приемниками

myAsyncLogger.cpp

 #include "spdlog/async.h" //support for async logging.
#include "spdlog/sinks/basic_file_sink.h"
#include <iostream>


int main(int, char* [])
{
    try
    {        
        auto async_file = spdlog::basic_logger_mt<spdlog::async_factory>("async_file_logger", "logs/async_log.txt");
       for (int i = 1; i < 101;   i)
      {
         async_file->info("Async message #{}", i);
      }
       // Under VisualStudio, this must be called before main finishes to workaround a known VS issue
        spdlog::drop_all(); 
    }
    catch (const spdlog::spdlog_examp; ex)
    {
        std::cout << "Log initialization failed: " << ex.what() << std::endl;
    }
}
  

Скомпилировано как:clang -o logAsync logAsync.cpp

выдает ошибку ниже :

 In file included from ./spdlog/async.h:21:
In file included from /usr/local/include/spdlog/details/registry.h:22:
In file included from /usr/local/include/spdlog/sinks/ansicolor_sink.h:9:
/usr/local/include/spdlog/spdlog.h:32:18: error: no member named 'registry' in namespace 'spdlog::details'
        details::registry::instance().initialize_logger(new_logger);
        ~~~~~~~~~^
/usr/local/include/spdlog/spdlog.h:55:21: error: no member named 'registry' in namespace 'spdlog::details'
    return details::registry::instance().get(name);
           ~~~~~~~~~^
/usr/local/include/spdlog/spdlog.h:61:14: error: no member named 'registry' in namespace 'spdlog::details'
    details::registry::instance().set_formatter(std::move(formatter));
    ~~~~~~~~~^
/usr/local/include/spdlog/spdlog.h:74:14: error: no member named 'registry' in namespace 'spdlog::details'
    details::registry::instance().set_level(log_level);
    ~~~~~~~~~^
/usr/local/include/spdlog/spdlog.h:80:14: error: no member named 'registry' in namespace 'spdlog::details'
    details::registry::instance().flush_on(log_level);
    ~~~~~~~~~^
/usr/local/include/spdlog/spdlog.h:87:14: error: no member named 'registry' in namespace 'spdlog::details'
    details::registry::instance().flush_every(interval);
    ~~~~~~~~~^
/usr/local/include/spdlog/spdlog.h:93:14: error: no member named 'registry' in namespace 'spdlog::details'
    details::registry::instance().set_error_handler(std::move(handler));
    ~~~~~~~~~^
/usr/local/include/spdlog/spdlog.h:99:14: error: no member named 'registry' in namespace 'spdlog::details'
    details::registry::instance().register_logger(std::move(logger));
    ~~~~~~~~~^
/usr/local/include/spdlog/spdlog.h:107:14: error: no member named 'registry' in namespace 'spdlog::details'
    details::registry::instance().apply_all(fun);
    ~~~~~~~~~^
/usr/local/include/spdlog/spdlog.h:113:14: error: no member named 'registry' in namespace 'spdlog::details'
    details::registry::instance().drop(name);
    ~~~~~~~~~^
/usr/local/include/spdlog/spdlog.h:119:14: error: no member named 'registry' in namespace 'spdlog::details'
    details::registry::instance().drop_all();
    ~~~~~~~~~^
/usr/local/include/spdlog/spdlog.h:125:14: error: no member named 'registry' in namespace 'spdlog::details'
    details::registry::instance().shutdown();
    ~~~~~~~~~^
/usr/local/include/spdlog/spdlog.h:131:14: error: no member named 'registry' in namespace 'spdlog::details'
    details::registry::instance().set_automatic_registration(automatic_registation);
    ~~~~~~~~~^
/usr/local/include/spdlog/spdlog.h:151:21: error: no member named 'registry' in namespace 'spdlog::details'
    return details::registry::instance().default_logger();
           ~~~~~~~~~^
/usr/local/include/spdlog/spdlog.h:156:21: error: no member named 'registry' in namespace 'spdlog::details'
    return details::registry::instance().get_default_raw();
           ~~~~~~~~~^
/usr/local/include/spdlog/spdlog.h:161:14: error: no member named 'registry' in namespace 'spdlog::details'
    details::registry::instance().set_default_logger(std::move(default_logger));
    ~~~~~~~~~^
16 errors generated.

  

Я ожидал, что это должно было сработать нормально, поскольку я использую clang , c 11

Ответ №1:

Да, на самом деле я решил ее. Для тех, кто ищет его решение, пожалуйста, обратитесь к [Ссылке]https://github.com/gabime/spdlog/issues/1014