OpenGL: error OpenGL header already included, remove this include, glad already provides it
## error OpenGL header already included, remove this include, glad already provides it
```sh
[ 50%] Building CXX object CMakeFiles/example.dir/example.cpp.o
In file included from /home/yubao/data/project/AIDevLib/useOpenGL/example.cpp:2:0:
/home/yubao/data/project/AIDevLib/useOpenGL/include/glad/glad.h:27:2: error: #error OpenGL header already included, remove this include, glad already provides it
#error OpenGL header already included, remove this include, glad already provides it
^~~~~
In file included from /home/yubao/data/project/AIDevLib/useOpenGL/example.cpp:2:0:
/home/yubao/data/project/AIDevLib/useOpenGL/include/glad/glad.h:873:0: warning: "GL_INVALID_INDEX" redefined
#define GL_INVALID_INDEX 0xFFFFFFFF
In file included from /usr/include/GL/gl.h:2050:0,
from /home/yubao/data/software/glfw/include/GLFW/glfw3.h:225,
from /home/yubao/data/project/AIDevLib/useOpenGL/example.cpp:1:
/usr/include/GL/glext.h:1355:0: note: this is the location of the previous definition
#define GL_INVALID_INDEX 0xFFFFFFFFu
In file included from /home/yubao/data/project/AIDevLib/useOpenGL/example.cpp:2:0:
/home/yubao/data/project/AIDevLib/useOpenGL/include/glad/glad.h:915:0: warning: "GL_TIMEOUT_IGNORED" redefined
#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFF
In file included from /usr/include/GL/gl.h:2050:0,
from /home/yubao/data/software/glfw/include/GLFW/glfw3.h:225,
from /home/yubao/data/project/AIDevLib/useOpenGL/example.cpp:1:
/usr/include/GL/glext.h:1430:0: note: this is the location of the previous definition
#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
CMakeFiles/example.dir/build.make:62: recipe for target 'CMakeFiles/example.dir/example.cpp.o' failed
make[2]: *** [CMakeFiles/example.dir/example.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/example.dir/all' failed
make[1]: *** [CMakeFiles/example.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
➜ build git:(master) ✗
```
change the order to:
```cpp
#include
#include
```
![yubao_blog_cover](https://raw.githubusercontent.com/yubaoliu/assets/image/yubao_blog_cover.png)
No comments