Downloading and running glut


I am having problems downloading glut on a linux system. I have tried installing both glut and mesa together and seperate several times. The first time I installed glut / mesa to my root directory. I fllowed the read me and there seemed to be no problems with the installation (however, i am not sure, I am also new to Linux). After the installation I tried to compile a program as a test but I had errors saying that many of the glu and gl header files and definition could not be found. I then tried installing the glut package to my /usr/src/ directory. I got the same errors when compiling. I also tried /usr/lib/, /usr/include and /usr/X11R6/ all of which gave me the same errors. I know the header files are available but for some reason they are not linking . When I compile I use gcc program.c -o program. I am in desperated need of help. I have spent several weeks trying to fix this problem. Any help or suggestions would be very much appreciated

Thank YOU


First of all glut & mesa should preferably be installed to /usr/lib, only the headers should be installed to /usr/include.

Once the libs have been installed to /usr/lib
you’ll need to run ldconfig, that is if the install didn’t automatically do it for you
doesn’t hurt to run it twice just to make sure…

open a terminal, su to root and run /sbin/ldconfig, like this:
su -c “/sbin/ldconfig”

To actually compile a program that links to glut (or any library) you need to tell the compiler to do so - “gcc program.c -o program” is not enough.

You’ll need to link to glut & gl and some basix X stuff, like this:

gcc program.c -lGL -lGLU -lX11 -lXext -lXmu -lXi -lm -o program

By the way, most modern Linux distro’s come with mesa already installed, so manually installing it is noramlly not neccesary.

Hope this helps…

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