Unofficial OpenGL Software Development Kit  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Troubleshooting

Header Inclusion Order

Headers must be included in certain orders. GLFW and FreeGLUT headers must be included after including one of the GL Load OpenGL headers. For example, if you want to use OpenGL 3.3 core with FreeGLUT, you must include them in this order:

#include <glload/gl_3_3.h>
#include <GL/freeglut.h>

This is because FreeGLUT requires some of the types defined in the GL Load headers. Normally, it would include GL/gl.h directly, but since GL Load cannot work with the old header, we have to forcibly include it outselves first.

The same goes for GLEW.

The GLimg library headers do not require the inclusion of any GL Load headers. Some of the Texture Generation functions return unsigned int instead of actual GLenum values in order to support this.

GL Util and GL Mesh headers can require GL Load inclusion on a case-by-case basis. Each file that requires it will have a notation in the documentation for that particular header file. Thus, if you include glutil.h or glmesh.h, you need to include a GL Load header first.

A good rule of thumb is to simply include the GL Load headers before including anything else from the SDK.