Okay, ive spent all day setting up Debian. I know a lot about computers, but nearly nothing about linux.
I installed the most recent xserver-xfree86 software, and set up a KDE windows manager.
I downloaded NEHE’s first tutorial for linux, and tried to compile it, and gcc cant find
GL/glut.h
GL/gl.h
GL/glu.h
i know theres somthign simple i can do, but i have no idea what. how can i get gcc to find these files? theyre supposed to come installed right? i apt-get install mesademos to get glut, but it still doesnt find htat.
code-
#include <GL/glut.h> #include <GL/gl.h> #include <GL/glu.h>
… etc (havnt even got to this part yet )
Did the error say that the header files were not found, or that the functions you used were “undefined.” They are 2 very different errors.
If you don’t have the GL headers in /usr/include/GL, you might have them someplace like /usr/X11R6/include/GL, and if that is the case, you may need to include -I/usr/X11R6/include on the command line…
The next problem that you will likely run into is linker errors caused by not specifying the libraries you need to link. You do that by using the -l option. If the library is named libGL.so, the -l option looks like -lGL. So for OpenGL libraries, you generally need -lGL -lGLU, and -lglut if you are using glut.
Again, the GL libraries might be found in /usr/X11R6/lib if they aren’t in /usr/lib. If that is the case you may need to add -L/usr/X11R6/lib.
Sometimes you may get undefined errors to other X functions, and will need to include those libraries as well. (-lXi and -lXmu are commonly needed). One way I use to check what library a function is in, is by executing the following:
grep functionName /usr/lib/*
or
grep functionName /usr/X11R6/lib/*
So, in summary, you may end up having a command line that looks like so:
gcc -o myprog myprog.c -I/usr/X11R6/include -L/usr/X11R6/lib -lGL -lGLU -lglut -lXi -lXmu
you should simply check manually if these files are present… located at /usr/include/GL/… if they are, fine, if not, install them. OpenGL header files can be found at