简体   繁体   English

包含glew C ++后无法使用glut函数

[英]Can't use glut functions after including glew c++

I use glut to create a basic openGL program. 我使用glut创建一个基本的openGL程序。 Everything worked fine until I included glew as well. 一切工作正常,直到我也加入了问题。 Now the compiler can't find the glut functions. 现在,编译器找不到glut函数。

I'm including them in this order: 我按以下顺序包括它们:

#include <GL/glew.h>
#include <GL/glut.h>

Using GL/gl.h instead of glew works but then I can't use the openGL extensions. 使用GL / gl.h代替glew可以,但是我不能使用openGL扩展。

The compiler outputs undefined reference for every glut and gl function like glutInit , glBegin . 编译器为每个glut和gl函数(如glutInitglBegin输出undefined reference I can't find any glut related .lib files on my hdd but for some reason it works when I don't include glew. 我在硬盘上找不到任何与glut相关的.lib文件,但是由于某些原因,当我不包含glew时它可以工作。 I already copied the glew files to the right directories. 我已经将glew文件复制到了正确的目录。 (glew32.lib, glew32mx.lib, glew32mxs.lib and glew32s.lib to mingw/lib, wglew.h, glxew.h, glew.h to mingw/include/GL and glew32.dll, glew32mx.dll to mingw/bin and windows/system32) (glew32.lib,glew32mx.lib,glew32mxs.lib和glew32s.lib到mingw / lib,wglew.h,glxew.h,glew.h到mingw / include / GL和glew32.dll,glew32mx.dll到mingw / bin和Windows / system32)

The compiler arguments are -lmingw32 -lSDLmain -lSDL -lglut32 -lglew32 -lglu32 -lwinmm -lgdi32 . 编译器参数为-lmingw32 -lSDLmain -lSDL -lglut32 -lglew32 -lglu32 -lwinmm -lgdi32

First, stop using old GLUT; 首先,停止使用旧的GLUT; use FreeGLUT instead. 请改用FreeGLUT。

Second, you still need to link to OpenGL32 if you want to use OpenGL. 其次,如果要使用OpenGL,则仍然需要链接到OpenGL32。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM