- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
最近,我从 Windows 转到 Linux 并尝试学习 Udemy 类(class),该类(class)最初是在 Windows 上使用 Visual Studio 教授的。
我需要使用两个头文件 glfw3.h 和 glew.h 在类中。
我可以导入 glfw3.h 并使用它就好了,但是 glew.h 函数显示一些错误。
我使用了代码 sudo apt-get install libglew-dev 获取库文件。但仍然会弹出错误。
代码:
#include <GLFW/glfw3.h>
#include <GL/glew.h>
int main(void)
{}
In file included from Lesson01.cpp:2:0:
/usr/include/GL/glew.h:85:2: error: #error gl.h included before glew.h
#error gl.h included before glew.h
^~~~~
In file included from Lesson01.cpp:2:0:
/usr/include/GL/glew.h:16088:93: error: conflicting declaration
‘typedef void (* PFNGLFRAGMENTLIGHTMODELFVSGIXPROC)(GLenum, GLfloat*)’
LAPIENTRY * PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, GLfloat*
params);
^
In file included from /usr/include/GL/gl.h:2055:0,
from /usr/include/GLFW/glfw3.h:171,
from Lesson01.cpp:1:
/usr/include/GL/glext.h:12070:25: note: previous declaration as
‘typedef void (* PFNGLFRAGMENTLIGHTMODELFVSGIXPROC)(GLenum, const
GLfloat*)’typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC)
(GLenum pname, const GLfloat *params);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from Lesson01.cpp:2:0:
/usr/include/GL/glew.h:16090:91: error: conflicting declaration
‘typedef void (* PFNGLFRAGMENTLIGHTMODELIVSGIXPROC)(GLenum, GLint*)’
(GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, GLint*
params);
^
In file included from /usr/include/GL/gl.h:2055:0,
from /usr/include/GLFW/glfw3.h:171,
from Lesson01.cpp:1:
/usr/include/GL/glext.h:12072:25: note: previous declaration as
‘typedef void (* PFNGLFRAGMENTLIGHTMODELIVSGIXPROC)(GLenum, const
GLint*)’ typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC)
(GLenum pname, const GLint *params);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
最佳答案
正如您的编译器所建议的,包含文件的顺序很重要:
error: #error gl.h included before glew.h
#include <GL/glew.h>
#include <GLFW/glfw3.h>
int main(void)
{
return 0;
}
关于linux - 无法在 Linux(Ubuntu)上使用 glew.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59783044/
使用glew,我正在尝试链接简单的程序 #include int main (int argc, const char * argv[]) { glewInit(); return
我有一个动态库,在构建中包含glew.c,并使用GLEW_STATIC 构建。如果另一个库链接到同一个应用程序并且还以某种方式包含 GLEW,是否有可能由于单一定义规则而导致 Linux 出现问题?
我在 Macintosh 上使用终端。 要编译的命令是基本的: g++ -c String.cpp -o String.o g++ -c FileIO.cpp -o FileIO.o g++ -c
我正在配置一个与 glut 一起工作的程序来与 Qt 一起工作。我正在使用 Qt 5.1.1。并且似乎从 Qt4 到 Qt5 已经丢失了一些 openGL 功能。在我的程序中,我创建了一个 QOpen
我正在尝试做 openGLbook.com 教程。我收到这个常见错误: 1>------ Build started: Project: OpenGL Startup, Configurati
我读过这个 [1],但在我的例子中,CMake 说它找不到 glew。 我在 Windows 上,我的 CMake 模块文件夹中有一个 FindGLEW.cmake 文件,大概是在我安装 CMake-
这很奇怪。我想在我的 gl 程序中实现着色器。 但 GLEW 告诉我,我的系统不支持着色器: //glut init and glew init ... if (GLEW_ARB_vertex_sha
我想使用三角扇绘制不同的图形,但我不知道如何让程序绘制第二个图形。每次我想更改颜色或绘制新图形时,是否需要第二个 vertexShaderSource 和第二个 fragmentShaderSourc
我现在对尝试链接这个 glew 库感到非常沮丧 这是构建日志: g++ -o test.exe "src\\test.o" -lglew32 -lglfw -lglu32 -lopengl32 src
当我尝试在 CLion 中构建我的项目时,我遇到了来自 cmake 的链接错误。我已经尝试过其他线程所说的:将 opengl 放在最后,将 glu 放在第一位,更改我的 include 的顺序并设置
我遇到了这个问题,不知道该怎么办? 'abc.exe': Loaded 'D:\Windows\SysWOW64\nvoglv32.dll', Cannot find or open the PDB
我只是想使用 SDL 2.0 和 glew 1.9 创建一个 openGL 上下文 构建项目时没有问题,但在调试时,GLEW 初始化失败,我该怎么做才能解决这个问题? 我正在使用 visual stu
我正在使用以下代码检查是否有任何错误: glfwInit(); glewExperimental = GL_TRUE; if (glewInit() != 0) { std::cout <<
不知何故,我无法在多个头文件中获取 Glew。它只是提示 Gl 已经在 GLEW 之前定义了。 简而言之,我有以下文件结构: 程序.h 包括: , 和 "SceneManager.h" . 场景管理器
我的机器有 OpenGL 2.0,由于一些奇怪的原因,头文件 gl.h 不包含着色器函数。所以,有人建议我使用 GLEW。我正确安装了 GLEW,并将 glew32s 链接到我的编译器,我还在我的 m
我需要在 Ubuntu 11.10 中加载扩展。我尝试构建 GLEW,但出现以下奇怪错误... ~/Downloads/glew-1.7.0$ make cc -shared -Wl,-soname=
这个问题在这里已经有了答案: What is an undefined reference/unresolved external symbol error and how do I fix it?
我试图通过将源文件添加到我的项目来跳过 glew 的“链接步骤”,以使代码更加灵活(目标 32 位和 64 位,只需稍作修改)。我已经使用 Code::Blocks 和 mingw 32 位实现了 3
出于我无法理解的原因,glew 在静态链接时根本不起作用。有没有一种方法可以简单地将 glew.h、glxew.h、wglew.h 和 glew.c 源文件包含到我的项目中并使用 #include "
我编译了 GLEW 库。它似乎工作正常,这里是 make install 的输出: install -d -m 0755 "/usr/include/GL" install -m 0644 inclu
我是一名优秀的程序员,十分优秀!