【问题标题】:spdlog unexpected include reference pointspdlog 意外包含参考点
【发布时间】:2018-10-06 12:58:55
【问题描述】:

我正在尝试在 hello world 中使用 spdlog 库。

#include "spdlog/spdlog.h"

int main()
{
    return 0;
}

由于它是“仅标头”库,我只是将它复制到我的项目的根目录,并期望一切正常。

|+ hello.cpp                         
|+ spdlog |         
          |+ spdlog.h
          |+common.h
     .....     

但是当我构建gcc hello.cpp

我得到:
spdlog/spdlog.h:10:10: fatal error: spdlog/common.h: No such file or directory #include "spdlog/common.h"
问题是 spdlog 库中的任何地方都引用了 spdlog 文件夹下的文件。在上面的示例错误中,spdlog.h 包含位于同一文件夹中的 common.h。但它是这样包含的:
#include "spdlog/common.h" 为什么在所有标题的所有包含中都添加了“spdlog”?
为了使用 spdlog,我应该怎么做?编辑其包含?

【问题讨论】:

  • 你能发布你的整个编译行吗?如果只是 GCC hello.cpp 那么你应该添加 -I"PATH to spdlog folder" 或 -I.

标签: c++ spdlog


【解决方案1】:

由于您的头文件路径是 spdlog/.h,因此您应该提供您的 spdlog 文件夹所在的路径。喜欢

gcc -c -I/<Path of spdlog parent folder> hello.cpp

【讨论】:

    猜你喜欢
    • 2021-02-24
    • 2011-12-23
    • 1970-01-01
    • 1970-01-01
    • 2015-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多