My code is very messy for now, however I cleaned it up some and included the project’s class right in the main document so that it would be easier to spot my problem.
I have simplified everything and I am still getting the error:
C1189 #error: OpenGL header already included, remove this include, glad already provides it
I tried adding : #define GLFW_INCLUDE_NONE, and tried adding this as a preprocessor definitions too. I also tried to change the #ifdef - #endif, except I just couldn’t get it working. The code repository URL is :
The branch is : combine_sources
The Commit ID is: 0b6bc74
The files involved are : shader_class.cpp and glad.h
glad1.cpp was also in my project, I removed it to try to solve this problem.
Can’t help you with “the solution”, but I remember having trouble with glew and the gl headers too. If I remember correctly glew must always be included before the gl headers. Check this link:
In your original post the error message reads:
C1189 #error: OpenGL header already included, remove this include, glad already provides it
it is doing the same stuff as glew (loading OpenGL extensions). So I don’t know if you really need both. Anyways, glew needs to be put in front of the glad headers, since it must be included before gl.h, which is automatically included by glad. However, if glew also includes the gl headers internally, than you have to decide for one of those two libs. This should not be a problem since they are meant to do the same thing as far as I understood it.