Get errors about redefinition (OpenGL 4.0 Shading Language Cookbook)

Hi, I have just started learning GLSL,

I just tested the code in chapter 1 (OpenGL 4.0 Shading Language Cookbook) (code download)

I have installed Qt5, qmake -tp vc chapter01.pro then open it in vs2010.

Built and got many errors like:

1>D:\APP\Qt5\5.0.0\msvc2010\include\GLES2/gl2.h(38): error C2371: 'GLintptr' : redefinition; different basic types
1>          D:\OpenGL\glew-1.5.4\include\GL/glew.h(1615) : see declaration of 'GLintptr'
1>D:\APP\Qt5\5.0.0\msvc2010\include\GLES2/gl2.h(39): error C2371: 'GLsizeiptr' : redefinition; different basic types
1>          D:\OpenGL\glew-1.5.4\include\GL/glew.h(1614) : see declaration of 'GLsizeiptr'
1>D:\APP\Qt5\5.0.0\msvc2010\include\GLES2/gl2.h(96): warning C4005: 'GL_BLEND_EQUATION_RGB' : macro redefinition
1>          D:\OpenGL\glew-1.5.4\include\GL/glew.h(1666) : see previous definition of 'GL_BLEND_EQUATION_RGB'
1>D:\APP\Qt5\5.0.0\msvc2010\include\GLES2/gl2.h(474): error C2365: '__glewActiveTexture' : redefinition; previous definition was 'data variable'
1>          D:\OpenGL\glew-1.5.4\include\GL/glew.h(12027) : see declaration of '__glewActiveTexture'
1>D:\APP\Qt5\5.0.0\msvc2010\include\GLES2/gl2.h(475): error C2365: '__glewAttachShader' : redefinition; previous definition was 'data variable'

How to solve these problems?

Thanks in advance.

First, I didn’t explicitly include gl2.h in this project. Second, I commented out all OpenGL headers and these errors still exist. Why?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.