gl.h 包含在 glew 之前,但 GLFW 需要 gl.h
我记得你订购 #include-s 的方式很重要。嗯,我有点麻烦了。我有这两个标头:
#include <gl/glfw.h>
#include <gl/glew.h>
如果我运行它,我会收到一条错误消息,指出 gl.h 包含在 glew.h 之前。但是如果我颠倒这两个的顺序以使 glew.h 位于第一个,我会收到很多错误。我只是想找出 #define-s 的含义,这样我就可以对自己说:#define Whatineed 0x0000x。
- 如何通过标题排列解决此问题。
- 寻找并定义我的定义的方法安全吗?
I remember that the way you order your #include-s matter. Well, I'm in a bit on trouble. I have these two headers:
#include <gl/glfw.h>
#include <gl/glew.h>
If I run that, I get an error saying that gl.h is included before glew.h. But If I reverse the order of those two so that glew.h is first, I get a LOT of errors. I was just thinking of hunting down what the #define-s mean so I could just say for me: #define whatineed 0x0000x.
- How can I fix this problem with the headers arrangement.
- Is the method of hunting and making my defines safe?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您首先包含 GLEW 标头时,您会遇到什么类型的错误?
GLEW 标头定义了禁用大多数 GL 标头的包含所需的所有魔法,因此在 GLFW 标头之前包含 GLEW 标头应该可行;应该是这样的,我已经在 Linux、Windows 和 Mac OS X 上使用本机 GCC、Clang、MinGW、Cygwin 和 VC++ 成功使用了很多年。它甚至是官方常见问题解答:
http://www .glfw.org/faq.html#can-i-use-extension-loaders-with-glfw
What sort of errors are you getting when you include the GLEW header first?
The GLEW header defines all the magic necessary to disable the inclusion of most GL headers, so including the GLEW header before the GLFW one should work; should as in I've used this successfully for a number of years on Linux, Windows and Mac OS X with native GCC, Clang, MinGW, Cygwin and VC++. It's even an official FAQ:
http://www.glfw.org/faq.html#can-i-use-extension-loaders-with-glfw
主要问题是 glfw.h 有一个显式检查来测试 gl.h 是否已经包含在内,如果包含则失败,而不是继续忽略该“错误”。我最终只是在我的库版本的标题中注释了这段代码。
The main problem is that glfw.h has an explicit check to test if gl.h has already been included and fail if it has, instead of just carrying on ignoring that "error". I ended up simply commenting that piece of code out of the header on my version of the lib.