A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
#include <glut.h> uses the angle‑bracket form, so the compiler does not look in the parent source file’s directory. It searches only the include paths specified on the command line (/I) and then the INCLUDE environment variable.
In Visual Studio, the equivalent of /I is the project’s Additional Include Directories setting, not the general VC++ Directories page. To make #include <glut.h> work:
- Open the project properties for the specific project.
- Go to Configuration Properties → C/C++ → General → Additional Include Directories.
- Add
C:\glutdlls36to this list. - Apply and rebuild.
Alternatively, use the quoted form and rely on the parent/source directory search order:
#include "glut.h"
In that case, either place glut.h in the same directory as the source file or ensure the directory is in the include search path as above.
Key points from the include search rules:
- Quoted form
#include "file"searches:- Directory of the file that contains the
#include. - Directories of currently opened include files (parent, grandparent), in reverse order.
- Directories specified by
/I. - Directories in the
INCLUDEenvironment variable.
- Directory of the file that contains the
- Angle‑bracket form
#include <file>searches:- Directories specified by
/I. - Directories in the
INCLUDEenvironment variable (for command‑line builds).
- Directories specified by
If C:\glutdlls36 is only set in VC++ Directories and not in Additional Include Directories, the compiler’s C/C++ include search will not find glut.h, which explains the error.
Also ensure the header name matches what OpenGL expects. Core OpenGL headers are typically included as:
#include <GL/gl.h>
#include <GL/glu.h>
If glut.h is in a subfolder (for example C:\glutdlls36\GL\glut.h), add C:\glutdlls36 to Additional Include Directories and include it as:
#include <GL/glut.h>
References: