错误 1 error C1189: #error : gl.h included before glew.h

1.OpenGL部分头文件包含顺序问题

#include "stdafx.h"

#include <gl/glew.h>

#include <gl/glew.h>

编译后出错

错误 1 error C1189: #error :  gl.h included before glew.h

         2 IntelliSense:  #error 指令:  gl.h included before glew.h

解决办法:

#include "stdafx.h"
#include <gl/glew.h>
#include <gl/glut.h>

2.lib文件链接问题

#include <gl/glew.h>

编译出错:

primrestart.obj : error LNK2001: 无法解析的外部符号 __imp____glewGenBuffers
primrestart.exe : fatal error LNK1120: 1 个无法解析的外部命令

解决办法:

右键单击项目——>属性——>配置链接器——>附加依赖项,添加glew的lib文件:glew32.lib,glew32mx.lib,glew32mxs.lib,glew32s.lib


猜你喜欢

转载自blog.csdn.net/lingsnoopy/article/details/53998807
今日推荐