无法获取“体系结构x86_64的未定义符号”的情况下,不能仅使用spdlog标头

时间:2019-06-15 18:38:17

标签: c++ spdlog

我已按照自述文件的“安装”部分中的说明将源文件夹(https://github.com/gabime/spdlog/tree/v1.x/include/spdlog)复制到我的项目中。

我尝试包括头文件并使用一个简单的用例,如下所示:

#define SPDLOG_HEADER_ONLY
#include "../third_party/spdlog/spdlog.h"
#include "../third_party/spdlog/sinks/basic_file_sink.h"

int main(int argc, char* argv[]){
    cout << "STARTING MAIN" << endl;
    spdlog::info("Welcome to spdlog!");
}

但是我得到了错误:

Undefined symbols for architecture x86_64:
  "spdlog::default_logger_raw()", referenced from:
      void spdlog::info<>(char const*) in main.cpp.o
  "spdlog::logger::log(spdlog::level::level_enum, char const*)", referenced from:
      void spdlog::logger::info<>(char const*) in main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [main] Error 1
make[1]: *** [CMakeFiles/main.dir/all] Error 2
make: *** [all] Error 2

我不确定我缺少什么,任何帮助将不胜感激!

0 个答案:

没有答案