# OpenGL Conflict between glew and sdl

This topic is 2681 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey there! I'm trying to compile some demo code provided by my lecturer and am having a hard time getting it to work.. I had to download and set up all the glew and sdl libraries and headers, and that is finnaly sorted. However now when I try to compile I get the following error(s): sdl_opengl.h(4855) : error C2371: 'PFNGLFRAGMENTLIGHTFVSGIXPROC' : redefinition; different basic types glew.h(9573) : see declaration of 'PFNGLFRAGMENTLIGHTFVSGIXPROC' And I get 6 errors of that type.. I would suppose sdl and glew would be compatible from the go, so I didn't change any of the code (and I hope I don't need to). Here are the lines that cause the errors: sdl_opengl.h: typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params); glew.h: typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat* params); They all seem to occur whenever the sdl...h has the last parameter set to const and glew.h doesn't.. I've been looking on the web for anything regarding this but can't seem to find a thing.. Anyone got a clue on how to solve this? (do I really have to change the glew/sdl headers?) EDIT: As I suspected removing the 'const' removes the error... but I'm not sure I should be meddling with the original headers.. :s

##### Share on other sites
I had a similar problem, and for me the solution was to define NO_SDL_GLEXT before including SDL_opengl.h. I'm guessing that will fix it for you too.

I also had a problem with the order of inclusion (I think glew.h needed to be included before SDL_opengl.h with that define), so to enforce the proper order and ensure that the define was always present I created a header file to use for those includes rather than including them directly. It just looks like this:
#define NO_SDL_GLEXT#include <GL/glew.h>#include "SDL_opengl.h"

1. 1
Rutin
24
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 9
• 46
• 41
• 23
• 13
• ### Forum Statistics

• Total Topics
631749
• Total Posts
3002038
×