1. Jason McKesson
  2. gltut
  3. Issues

Issues

Issue #28 resolved

errors compiling glload/Test

Anonymous created an issue

I have problems building the test for glload library (and consequently all tutorias). I get compilation error when compiling windows.cpp: 'GLAPI' does not name a type.

I'm using windows7 64b , mingw compiler set and codeblocks as IDE. I don't know if this is the appropriate place to ask but I couldn't find any helpful information on the net...

here is the complete build log: {{{

!html

Build started on: 03-06-2011 at 02:14.59 Build ended on: 03-06-2011 at 02:15.00 -------------- Build: Debug in glload --------------- Target is up to date. -------------- Build: Debug in Test --------------- g++.exe -g -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -DWIN32 -DDEBUG -D_DEBUG -DMEMORY_DEBUGGING -I..\include -IC:\MinGW\include -c C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp -o Debug\windows.o In file included from C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:13:0: c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:225:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:226:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:227:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:228:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:229:1: error: 'GLAPI' does not name a type In file included from C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:13:0: c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:230:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:231:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:232:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:233:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:234:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:235:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:236:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:237:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:238:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:239:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:240:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:241:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:242:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:243:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:244:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:245:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:246:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:247:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:248:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:249:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:250:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:251:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:252:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:253:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:254:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:255:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:256:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:257:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:258:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:259:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:260:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:261:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:262:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:263:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:264:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:265:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:266:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:267:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:268:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:269:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:270:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:271:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:272:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:273:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:274:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:275:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:276:1: error: 'GLAPI' does not name a type c:\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/gl\glu.h:277:1: error: 'GLAPI' does not name a type C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:47:12: error: '' has incomplete type C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:47:18: error: invalid use of 'GLvoid' C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:58:17: error: '' has incomplete type C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:58:23: error: invalid use of 'GLvoid' C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:110:21: error: '' has incomplete type C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:110:27: error: invalid use of 'GLvoid' C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp: In function 'BOOL CreateGLWindow(TCHAR, int, int, int, bool)': C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:255:16: error: too few arguments to function 'GLvoid KillGLWindow()' C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:110:8: note: declared here C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:284:16: error: too few arguments to function 'GLvoid KillGLWindow()' C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:110:8: note: declared here C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:291:16: error: too few arguments to function 'GLvoid KillGLWindow()' C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:110:8: note: declared here C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:298:16: error: too few arguments to function 'GLvoid KillGLWindow()' C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:110:8: note: declared here C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:305:16: error: too few arguments to function 'GLvoid KillGLWindow()' C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:110:8: note: declared here C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:312:16: error: too few arguments to function 'GLvoid KillGLWindow()' C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:110:8: note: declared here C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:325:14: error: too few arguments to function 'int InitGL()' C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:47:5: note: declared here C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:327:16: error: too few arguments to function 'GLvoid KillGLWindow()' C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:110:8: note: declared here C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp: In function 'int WinMain(HINSTANCE*, HINSTANCE, CHAR, int)': C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:411:73: warning: deprecated conversion from string constant to 'TCHAR' C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:441:18: error: too few arguments to function 'int DrawGLScene()' C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:58:5: note: declared here C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:449:18: error: too few arguments to function 'GLvoid KillGLWindow()' C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:110:8: note: declared here C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:452:76: warning: deprecated conversion from string constant to 'TCHAR*' C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:461:15: error: too few arguments to function 'GLvoid KillGLWindow()' C:\Users\millag\Downloads\programs\tutorial\glload\Test\windows.cpp:110:8: note: declared here Process terminated with status 1 (0 minutes, 0 seconds) 50 errors, 0 warnings }}}

Comments (7)

  1. Jason McKesson repo owner
    • changed status to open

    That's just the test program for glload. You don't need to build it to build the tutorials. I haven't tried building any of this stuff with GCC-based Windows tools.

  2. millag

    I've mentioned the test program because I was getting the same errors when trying to compile the first tutorial and I suppose it has something to do with glload.

    However, after a few more hours of suffering and googling I managed to build the tutorials with mingw (in fact I tried only a few of them).

    It seems that the definition of GLAPI (made in gl.h) somehow got messed up. So what I did was a quick and dirty hack of redefining it again before #include <GL/freeglut.h> or #include <gl\glu.h>. I actually had to do this whenever headers from glload were included.

    The second thing that was causing the function arguments errors was the typedef of void as GLvoid (again in gl.h). It turned out to be a mingw issue according to this : http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9278 so I defined GLvoid to be void with a macro.

    One last thing I did was to add winmm, gdi32 and opengl32 in link libraries for the project after freeglut library since it depends on them and "Voila!". The problem is I don't know if redefining GLAPI and GLvoid can be considered ok. I personally don't like it and will be grateful if you could give me any tips or work arounds.

  3. Jason McKesson repo owner

    All of the glload headers will fail if "gl.h" was included beforehand. This is by design, as glload cannot inter-operate with regular "gl.h" headers. If you try to include "gl.h" after including a glload header, then the "gl.h" header will not be included, since the glload headers define include guards that "gl.h" does. Again, this is by design since they cannot inter-operate.

    The problem is that "glu.h", which for some reason FreeGLUT includes, expects certain defines from "gl.h". But since glload headers stop the "gl.h" defines from being defined, there is a problem. I don't know how the GLVoid problem comes about, but I do know how GLAPI became a problem. I suppose I'll have to add something to the code generation script that builds the glload headers to provide this define so that "glu.h" works.

  4. Log in to comment