Bugzilla – Bug 686
gl3.h needs CPP include guard against including gl.h
Last modified: 2012-08-08 12:49:41 PDT
The comment block at the top of gl3.h reads as follows: * It is not possible to #include both <GL3/gl3.h> and either of * <GL/gl.h> or <GL/glext.h> in the same source file. However, it is in fact possible to include both gl3.h and gl.h, at least on Windows. If both are included, then use of deprecated GL commands (such as glPushAttrib()) doesn't generate a compile error. To protect against including both files, gl3.h could add an additional CPP include guard. Currently, gl3.h has this: #ifndef __gl3_h_ #define __gl3_h_ But we'd need to add another guard to protect against includeing both headers: #ifndef __gl_h_ #define __gl_h_ This would prevent both gl3.h and gl.h from being included. If the user's source code included gl.h first, then gl3.h would be skipped; if the source included gl3.h first, then gl.h would be skipped. As an alternate fix, the comment block at the top of gl3.h could be clarified to state that it is technically possible to include both headers, but this should be avoided. It is also possible that this is merely a Windows-specific issue, in which case I apologize for wasting your time. :-) (Note that glu.h typically includes gl.h indirectly, so the list of files that should not be included with gl3.h should also include glu.h.)
Please replace all uses of "gl3.h" with "glcorearb.h". Thanks.