[glew] Including glew.h after gl.h
Hi,
So I'm having an issue. As you know, it is not possible to include glew after gl.h has been included. I am having a slight issue with this.
So I have a main.cpp, which includes gl.h. The main.cpp sets up OpenGL. So I include glew.h before gl.h. That's fine.
Then I have Scene.h and .cpp. The functions are being called within the main.cpp. My problem is that in Scene.cpp, I need to call glGenBuffers, which requires glew.h. But if I include glew.h in scene.h or .cpp. I get the error because glew has been included after gl.h.
Sorry if this is confusing but I want to know how I can get around this.
Thanks in advance.
Posted Jan 12, 2014, 10:04 PM UTC
[deleted]
You are correct. glew.h contains the contents of gl.h, glext.h, and glati.h. No need to have gl.h in your files unless you find yourself needing brand new functions not supported by glew yet after a new opengl release.
[deleted]
Yeah C++/C Header files can sometimes be a bitch, but it's quite logical once you get the hang of it. Working with external libs can be annoying again though.
What's also worth looking into (if you haven't already) is circular inclusion and forward declaration.