0

I have installed spdlog manually from git repo having version 1.3.1 in version.h . Now i am trying to execute basic examples given in the repository but they are giving certain errors. Synchronous loggers example are running fine though.

I have tried 2 examples : asynchronous logger creation with spdlog and asynchronous logger with multiple sinks

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_ex& ex)
    {
        std::cout << "Log initialization failed: " << ex.what() << std::endl;
    }
}

Compiled as :clang++ -o logAsync logAsync.cpp

gives below error :

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.

I was expecting that it should have worked fine as i am using clang++ , c++11

nishu jain
  • 11
  • 1
  • 5

1 Answers1

0

Yes, actually i got it resolved. For someone looking out for its solution kindly refer [Link] https://github.com/gabime/spdlog/issues/1014

nishu jain
  • 11
  • 1
  • 5