windows.h before gl.h

Started by
2 comments, last by CrazyCdn 17 years, 10 months ago
Is windows.h always supposed to be included before gl.h on the Windows platform? I ask because at least two libraries have failed to compile because they don't include windows.h before gl.h. I would expect these crossplatform libraries to do a check like #ifdef __WIN32__ #include <windows.h> #endif So it makes me suspect I am doing something wrong. It fails on this line in GL/gl.h:
WINGDIAPI void APIENTRY glAccum (GLenum op, GLfloat value);
So I had to add an #include <windows.h> and I suppose I should also do the mean and lean thing, right?
Advertisement
Yeah you need to do windows.h before OpenGL headers. As for the lean and mean you can use it or not its up to you. It just removes a bunch of code that you probably won't use for games... I have it called and haven't had any errors or any reason to not use it.

It is used to exclude rarely-used services from Windows headers. Also if you are using MFC its automatically used.
Yeah, I'll add lean and mean to be defined in my project settings.

So my question: Should I modify gl.h to include windows.h or should I modify each file that includes gl.h? Moreover, why isn't windows.h automatically included from gl.h?
Don't modify gl.h, you will likely get a new version of it and forget.

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety." --Benjamin Franklin

This topic is closed to new replies.

Advertisement