【发布时间】: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.