#error Attempt to include auto-generated header after including gl.h

I am trying to include different headers to my main.cpp file, right now I only have these ones:


#include <glad/glad.h>
#include "wrapper_glfw.h"
#include "object_ldr.h"

The problem is that I am getting this error message:

Attempt to include auto-generated header after including gl.h
I am not sure what does it mean or how can I fix it. I have researched for a while and I have found some problems with glad and glfw but still not sure how to fix this.

The object_ldr.h file includes wrapper_glfw.h and wrapper_flw.h includes glfw3.h, gl_4_0.h and gl_load.h.

The object_ldr.h file includes wrapper_glfw.h and wrapper_flw.h includes glfw3.h, gl_4_0.h and gl_load.h.

Your code seems to be quite confused. You can’t use more than one OpenGL loading library at the same time (not for most of them, at any rate). Many of them create the same definitions, so they often overlap. That’s why you’re getting that error.

Pick a single loading library and stick with it.