Michael IV
Michael IV

Reputation: 11424

Qt5.2.1 : error: gl.h included before glew.h is NOT SOLVED

I have been trying to solve the widely known problem with including GLEW into Qt.And I still haven't succeeded. Before people here start downvoting for repeating question; I actually went through this ,this and this SO post which explain the workaround.

  1. I recompiled Qt 5.2.1 from sources using opengl desktop configs. Didn't help.

  2. I put glew.h and Qt unrelated stuff into another header/cpp and it also didn't help.

  3. I tried to include glew.h before my #include <QGLWidget> and it didn't work as well.The only case it does work is when I put glew.h at the top of main.cpp which is of course unacceptable in app design terms.

So I am asking what else can be done here? I know I can use Qt gl headers which supply GL function pointers just like GLEW but I can't do that as I have a lib linked to Qt which uses GLEW. Once I use that lib content I am getting all that mess with "gl.h included before glew.h".

Upvotes: 1

Views: 1693

Answers (1)

rubenvb
rubenvb

Reputation: 76519

Why would including <glew.h> at the top of main.cpp be "unacceptable"? (hint: it's not)

It seems like you need to ensure that everywhere in your code, the glew.h header is included before Qt gets a chance to do that. I'd add it to my global.h style header and make sure to include that in every header in my project.

Upvotes: 1

Related Questions