Glu.h help needed!


I recently upgraded my machine to mandrake 8.2, and I have finally got back to looking at opengl stuff. Anyways, after installing the nvidia header files, nothing that includes glu.h will compile! I get syntax
errors in glu.h, as follows:

gcc -Wall -ansi lesson11.c -o lesson11 -L/usr/X11R6/lib -lGL -lGLU -lm sdl-config --cflags --libs
In file included from lesson11.c:17:
/usr/include/GL/glu.h:263: parse error before *' /usr/include/GL/glu.h:265: syntax error before void’
/usr/include/GL/glu.h:265: warning: data definition has no type or storage class/usr/include/GL/glu.h:266: syntax error before `void’

(above is nehe lesson 11 SDL version).

the error relates to two #define’s that
are missing from the file, GLAPIENTRY and
GLAPI, which seem to be defined in gl.h
in the mesa version of the file, but not in the nvidia version of gl.h

anyone else run into a problem like this? I
tried cheating and adding those defines to glu.h directly, but I am sure that is not the right solution is it???

any help appreciated, thanks.

you may use glut ??? so add -lglut and all for X ( -lXext…)

Originally posted by jide:
you may use glut ??? so add -lglut and all for X ( -lXext…)

That doesn’t explain why I get syntax errors from glu.h

I have come across this exact problem.
For some reason (I can’t remember exactly what it was) Mesa’s glu was not working correctly. So I downloaded glu from sgi. Do a search on glu / sgi, and you will find an rpm to install. – I believe that I found it on the Mesa site.

Note: glu is only a utility library, nothing in it is hardware accelerated, so you don’t have to worry about hardware compat.

Mesa --glut-- works fine so keep it, it is also just software - so there will be no driver problems.

Mesa --gl-- must not be installed to get the NVidia hardware working.

So, here it is, you need:
-the gl librarys/headers from NVidia
-the glu librarys/headers from sgi
-the glut librarys/headers from Mesa

This is my workaround:

  • I installed the NVidia drivers and made sure that they were working + there were no Mesa packages installed.

  • I installed the Mesa glut librarys with the --nodeps argument (the rpm dependency requires Mesa gl to be installed):
    this is called libMesaGlut3, and libMesaGlut3devel in Mandrake.

  • I installed sgi’s glu like so:
    rpm -i oss-opengl-glu-20000925-1.i386.rpm

  • I replaced the gl system header files (found in /usr/X11R6/include/GL) with the headers found in the NVidia directorys, (/usr/share/doc/NVIDIA_GLX-1.0/NVIDIA-GL-includes/)

That’s it. Now all my software using opengl/glut/glu compiles and works


Thanks man! That solved my problem exactly.

This is my first post in this forumn, weeee!

Just wanted to make a correction to your workaround I have noticed. I ran into the same problem so I tried your solution. It seemed to work except for one thing. There was no libMesaglut3devel. The correct name (for those of you going to is libMesaglut3-devel This I believe contains the glut.h files and is nessecary to compile your glut programs

Besides that great job dude that helped a lot

Of course, the simplest soulution is to use the gl.h & glu.h includes from here (click on “GL Includes” to the left), and instead of using GLUT, use GLFW .

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.