Reputation: 1
I want to forward declare an GLuint in a header of class Foo, but the implementation of GLuint changes depending on the operating system. Is there a portable way to forward declare the GL types given by opengl without having to include that huge header file?
Upvotes: 0
Views: 949
Reputation: 162224
Is there a portable way to forward declare the GL types given by opengl without having to include that huge header file?
The OpenGL is a pure C header file (it has a few #ifdef
-s to deal with C++ linkage, but that's it). Being a pure C header means, that it parses very fast. This is not like C++ where each header file included poses a potentially significant burden. You could probably add #include <GL/gl.h>
to each and every source file (.hh
and .cc
) in a large project and it would increase compilation time only by a few hundred ms.
Upvotes: 3
Reputation: 64223
Unless you want to use templates, the only option is to include that header file.
You can also create your own header, with those typedefs, but you will have to maintain it yourself. Such typedefs are very unlikely to change in the future.
Upvotes: 3