我想在我的項目中使用spdlog。根據spdlog docu,我只需要在include文件夾下複製文件並使用C++ 11編譯器。C++ SPDLOG編譯錯誤:變量或字段'set_error_handler'宣佈無效
我將/ include/spdlog文件夾複製到我的項目根文件夾中,但在嘗試構建項目後出現很多錯誤。有些是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);
我試圖加入,在下文中的CMakeLists.txt
target_include_directories(ProjectName INTERFACE spdlog)
include_directories(spdlog)
target_link_libraries(ProjectName .... -libspdlog-dev)
(我裝libspdlog-DEV)
add_subdirectory(spdlog)
但沒有上述作品。有誰知道我該如何解決這個問題?非常感謝!