Tag Archives: Cannot Open “gl/glut.h” File Error

[Solved] Cannot Open “gl/glut.h” File Error: No such file or directory

reason:

Lack of header files and libraries for compiling OpenGL;

Solution:

1. Download OpenGL header files and libraries;

2. Put the file in the specified directory;

(1) Copy glaux.dll, glut32.dll and glut.dll to the C:/Windows/system32 directory. There should be opengl32.dll and glu32.dll in the system32 directory
(if the computer is a 64 bit operating system, copy it to the syswow64 folder in C:\windows, otherwise the prompt of “the computer loses the glut32.dll file” will appear during operation)
(2) copy GL. H, glaux. H, Glu. H and glut. H to the folder D:\software\vs2015\VC\include (Note: the directory where each person installs vs is different, and you can adjust it according to your own situation)
(3) copy glaux.lib, glu32.lib, glut32.lib, opengl32.lib and glut.lib to D:\software\vs2015\VC\lib folder

Note:
compile again. If there is still an error, change the original name #include <GL/glut.H > of the header file to #include <glut.H>.