View Full Version : header recognition

08-12-2007, 05:11 PM
I am trying to compile via GCC a sample of Mesa-7.0 demo-code. The compiler complains that GL/glut.h does not exist. It does exist and I've made doubly sure that glut.h is exactly where it's supposed to be. When I look at glut.h it's in C code. Should it be compiled to object form before trying to use it as a header? I'm missing something here and my beginner status with Linux isn't helping much. Can anyone help?

Many Thanks

Stuart McDonald
08-12-2007, 10:28 PM
THe compiler searches for header files using the include paths. Some paths are already built in (to look for system header files in known locations) e.g. /usr/include.

You can add to the include paths using the -I compiler flag e.g. if your demo code has

#include <GL/glut.h>

and the glut.h file is (for exmaple) in


then you would add

-I /usr/local/include

to the compiler options. You can add multiple -I paths. Use man gcc and read up on the various options and google for the error you are getting.