Conflicting #include guards with Windows SDK

Issue #32 invalid
created an issue


I created a profile using the example provided on the wiki:

lua52.exe LoadGen.lua -style=pointer_c -spec=gl -version=3.3 -profile=core core_3_3

Copying the generated files into my project but compiling (as an exe) gives the following errors:

1>c:\coding\test\src\main.c(13): warning C4013: 'glMatrixMode' undefined; assuming extern returning int
1>c:\coding\test\src\main.c(13): error C2065: 'GL_PROJECTION' : undeclared identifier
1>c:\coding\test\src\main.c(14): warning C4013: 'glLoadIdentity' undefined; assuming extern returning int
1>c:\coding\test\src\main.c(16): error C2065: 'GL_MODELVIEW' : undeclared identifier

gl\GL.h is being found by the compiler (as verified by adding a #error line to it).

I suspect that the declarations from GL.h are not being compiled because gl_core_3_3.h defines __gl_h_ and others which the Microsoft-provided GL.h uses as a guard against multiple inclusion (#ifndef __gl_h_). The result is that none of the GL-related identifers are declared.

The complete test program is attached.

System: Windows7 (x64) MS VisualStudio 2010 Professional glLoadGen v1.0.4

Thanks in advance.

Comments (5)

  1. Jason McKesson repo owner

    You are not supposed to include gl.h. The headers generated by glLoadGen are supposed to replace your inclusion of standard OpenGL headers, not augment it.

    Your basic problem comes from generating core profile headers, but then using compatibility profile features (GL_PROJECTION and such). If you wanted to use compatibility profile features, you should generate compatibility profile headers and source using -profile=compatibility.

  2. Jason McKesson repo owner

    I meant that it expects the OpenGL header generated by glLoadGen to be included. That is, I didn't put #include "gl_someHeaderName.h" in the example. I'll clarify it.

  3. Log in to comment