Sign in to follow this  
Zepee

OpenGL Conflict between glew and sdl

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 this post


Link to post
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"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this