I'm trying to use spdlog in my project. According to spdlog docu, I just need to copy files under include folder and use a C++ 11 compiler.
I copied the /include/spdlog folder to my project root folder but I'm having a lot of errors after trying to build the project. Some are the ff:
/home/project/Documents/project-server/spdlog/spdlog.h:46:39: error: variable or field ‘set_error_handler’ declared void
void set_error_handler(log_err_handler);
^
/home/project/Documents/project-server/spdlog/spdlog.h:46:24: error: ‘log_err_handler’ was not declared in this scope
void set_error_handler(log_err_handler);
^
In file included from /home/project/Documents/project-server/main.cpp:13:0:
/home/project/Documents/project-server/spdlog/spdlog.h:74:79: error: ‘filename_t’ does not name a type
std::shared_ptr<logger> basic_logger_mt(const std::string& logger_name, const filename_t& filename, bool truncate = false);
^
/home/project/Documents/project-server/spdlog/spdlog.h:75:79: error: ‘filename_t’ does not name a type
std::shared_ptr<logger> basic_logger_st(const std::string& logger_name, const filename_t& filename, bool truncate = false);
^
/home/project/Documents/project-server/spdlog/spdlog.h:80:82: error: ‘filename_t’ does not name a type
std::shared_ptr<logger> rotating_logger_mt(const std::string& logger_name, const filename_t& filename, size_t max_file_size, size_t max_files);
I have tried adding the following in the CMakeLists.txt
target_include_directories(ProjectName INTERFACE spdlog)
include_directories(spdlog)
target_link_libraries(ProjectName .... -libspdlog-dev)
(I installed libspdlog-dev)
add_subdirectory(spdlog)
but none of the above works. Does anyone know how I can fix this? Thanks a lot!