即使给出正确的路径也无法打开包含文件
一段时间没有使用 VS 后,我一直在 Visual Studio 中测试一些东西,我遇到了一个问题,我包含一个文件并收到此错误:
Cannot open include file 'spdlog/spdlog.h': No such file or directory
但我有正确的路径,在项目设置中我有正确的路径设置为附加包含目录并且文件就在那里。但问题是,当我获取文件并将其向上移动一个目录并更改包含路径,使其现在指向向上一个目录(文件现在所在的位置)时,它突然起作用了。示例:
文件路径:Project/lib/spdlog/spdlog.h 包含目录:Project/lib 此作品
文件路径:Project/lib/spdlog/spdlog/spdlog.h 包含目录:Project/lib/spdlog 这不起作用
我不想包含 lib 目录,因为其中有更多库,它只会弄乱一些东西,所以我想单独包含每个库(例如 spdlog)。有谁知道可能导致问题的原因是什么?此外,仅当我尝试构建项目时编写代码时才不会显示错误。
I've been testing some stuff in Visual Studio after some time not working with VS, And I ran into a problem where I include a file and I get this error:
Cannot open include file 'spdlog/spdlog.h': No such file or directory
but I have the right path, in Project settings I have the right path set as an additional Include directory and the file is there. but the Thing is, when I take the file and move it one directory up and change the include path so that it now points one directory up (where the file is now) it suddenly works. Example:
File Path: Project/lib/spdlog/spdlog.h
Include directory: Project/lib
this Works
File Path: Project/lib/spdlog/spdlog/spdlog.h
Include directory: Project/lib/spdlog
This doesn't work
I don't want to include the lib directory since I have more libraries in it and it would just mess some stuff up, so I want to include every library (like spdlog for instance) separately. Does anyone know what might be causing the issue ? Also the error isn't shown when writing the code only when I try to build the Project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许您缺少 spdlog 库。
我建议您查看这个问题。
对于类似 debian 的发行版,您应该能够通过 apt-get 下载它:
apt-get install libspdlog-dev
。Maybe you are missing spdlog library.
I suggest you check out this issue.
For debian-like distros you should be able to download it via apt-get:
apt-get install libspdlog-dev
.