Conflict between glew and sdl

Started by
1 comment, last by Geometrian 13 years, 1 month ago
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
Advertisement
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"
Had same problem; marvelous; thanks!

[size="1"]And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.
[size="2"]

This topic is closed to new replies.

Advertisement