关于 X11 头文件的 OpenGL Glew 错误

发布于 2024-11-01 17:11:52 字数 1119 浏览 0 评论 0原文

好吧,我对 OpenGL 还算陌生,但我想我应该学习使用 OpenGL,因为它目前从一开始就应该使用。因此,我将跳过所有使用 glew 访问 OpenGL 3.x 的固定管道内容,并按照在线教程进行操作。

在线教程只提到我必须先安装 glew 本身才能开始,因为我有一张显卡,其驱动程序附带 OpenGL 4.0。所以我已经准备好了,我已经下载了 win32 版本的 glew 二进制文件,安装了它,在 VC++ 2010 中创建了一个项目,设置了所有路径,并按照教程制作了一个快速的 OpenGLContext 类来创建渲染上下文,并将其放入女士窗口(无过剩)。问题是当我构建这个类时,我在 glew 头文件之一中收到错误。

它涉及一系列涉及 X11 的标头包含。该教程似乎暗示我不应该去查找并下载并设置X11的路径信息,所以我不知道我做错了什么。有什么帮助、建议等吗?

这是具体错误:“1>c:\glew\glew-1.5.8\include\gl\glxew.h(97): fatal error C1083: Cannot open include file: 'X11/Xlib.h': No such文件或目录”

与该错误有关的唯一来源是错误中所述文件顶部的一系列包含语句。

下载的glew库可以在这里找到: https://sourceforge.net/projects/glew/files/glew/1.5.8/glew-1.5.8-win32.zip/download

我不知道这是否重要,但这是我引用的方式我的源更新中的 OpenGL 和 glew

#pragma once 

#include <gl/glew.h>
#include <gl/wglew.h>
#include <gl/GL.h>

#pragma comment(lib, "glew32.lib")
#pragma comment(lib, "opengl32.lib") 

:通过删除 gl/GL.h 包含修复了此错误...是的,我也不知道...无论如何,整个项目都表现得很有趣...

Okay so I'm kind of new with OpenGL, but I thought I should learn to use OpenGL as it's currently meant to be used from the word go. So I'm skipping all the fixed pipeline stuff using glew to access OpenGL 3.x and following a tutorial online.

The tutorial online only mentions I will have to install glew itself to begin, as I have a graphics card whose drivers come with OpenGL 4.0. So I'm all set, I've downloaded the win32 version of the glew binaries, installed it, made a project in VC++ 2010 set all the paths, and followed the tutorial and have made a quick OpenGLContext class that makes a render context, and puts it into a Ms Window (without glut). The problem is when I build this class I get an error inside one of the glew header files.

It's concerning a series of header includes involving X11. The tutorial seems to imply that I shouldn't have to go find and download and set up path information for X11, so I don't know what I did wrong. Any help, suggestions, etc?

Here is the specific error: "1>c:\glew\glew-1.5.8\include\gl\glxew.h(97): fatal error C1083: Cannot open include file: 'X11/Xlib.h': No such file or directory"

The only source concerned with the error are a series of include statements at the top of the file stated in the error.

The glew library downloaded can be found here: https://sourceforge.net/projects/glew/files/glew/1.5.8/glew-1.5.8-win32.zip/download

I dunno if this matters, but here's how I've referenced OpenGL and glew in my source

#pragma once 

#include <gl/glew.h>
#include <gl/wglew.h>
#include <gl/GL.h>

#pragma comment(lib, "glew32.lib")
#pragma comment(lib, "opengl32.lib") 

UPDATE: this error was fixed by removing the gl/GL.h include... yeah I dunno either... in any case, this whole project is acting funny...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

请远离我 2024-11-08 17:11:52

GLEW 安装指南 提到 glew.h 应该 替换 gl.h

更简单但不太灵活的方法是将 glew.h 和 glew.c 包含到您的项目中。在 Windows 上,您还需要在构建静态库或可执行文件时定义 GLEW_STATIC 预处理器标记,以及在构建 dll 时定义 GLEW_BUILD 预处理器标记。您还需要在代码中替换 and 并设置适当的包含标志 (-I) 来告诉编译器在哪里查找它。

另外,请查看另一个问题的此答案,了解 GLEW 的一些技巧。

The GLEW installation guide mentions that glew.h should replace gl.h.

The simpler but less flexible way is to include glew.h and glew.c into your project. On Windows, you also need to define the GLEW_STATIC preprocessor token when building a static library or executable, and the GLEW_BUILD preprocessor token when building a dll. You also need to replace and with in your code and set the appropriate include flag (-I) to tell the compiler where to look for it.

Also, check out this answer to another question for some of GLEW's tricks.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文