# windows.h before gl.h

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

## Recommended Posts

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?

##### Share on other sites
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.

##### Share on other sites
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?

##### Share on other sites
Don't modify gl.h, you will likely get a new version of it and forget.

1. 1
Rutin
46
2. 2
3. 3
4. 4
5. 5

• 13
• 10
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632995
• Total Posts
3009773
• ### Who's Online (See full list)

There are no registered users currently online

×