我正在尝试包含 Glad(使用 GL3.3 api 从此处生成(GLFW 也有类似的包含问题))
#include <glad/glad.h>
我觉得这应该可以工作,因为我在项目中为文件添加了额外的包含目录
vendor\Glad\include
我的 VS 解决方案的文件结构为
-solutionName
--projectName
---src
----projectname.h <- Where I am including from for now, latter I want to include from elsewhere under the src directory.
---vendor (same level as src)
----Glad
-----include
------glad
-------glad.h
------KHR
-------khrplatform.h
通过将文件包含为
#include <../vendor/Glad/include/glad/glad.h>
但是当我这样做时,我得到一个错误(“C1083”“无法打开包含文件:'KHR/khrplatform.h':没有这样的文件或目录”),因为glad.h中的包含在它时找不到khrplatform.h包括这样
#include <KHR/khrplatform.h>
我可以在glad.h 中更改该行,但我真的不想更改库的代码来使我的工作。
这也发生在 GLFW 上,它镜像了额外的包含目录和文件路径,但很高兴在适用的情况下替换为 GLFW。
此外,Visual Studio 将提供
<glad/glad.h>
当我在 projectName.h 中输入包含行时建议使用文件路径,但我仍然收到错误“C1083”“无法打开包含文件:'glad/glad.h':没有这样的文件或目录”。
另一个怪癖是我使用 spdlog 文件的附加包含目录
vendor\spdlog\include
并且能够在 src 目录中包含标题,如下所示:
#include <spdlog/spdlog.h>
哪个有效,不会抛出问题。
这个文件结构是
-solutionName
--projectName
---src
----Utilities
-----Logger.h <- Where I am including from.
---vendor (same level as src)
----spdlog
-----include
------spdlog
-------spdlog.h <- file I am including just fine.
这让人感觉只有一些额外的包含目录实际上在工作,我不确定为什么会发生这种情况,或者在花了几个小时进行猜测和检查后如何修复它。我想包括像
#include <glad/glad.h>
#include <GLFW/glfw3.h>
我怎样才能使这项工作?
谢谢你的时间,-迈克尔