我正在尝试在hello世界中使用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?编辑它的包含?
发布于 2018-10-06 13:11:23
由于您的头文件路径是spdlog/.h,所以您应该提供spdlog文件夹驻留的路径。喜欢
gcc -c -I/<Path of spdlog parent folder> hello.cpphttps://stackoverflow.com/questions/52679326
复制相似问题