Important: Please read the Qt Code of Conduct -

How do I get a subclass of QGLWidget that uses glew compiled under Qt5?

  • Hi everyone,
    I have posted this on stackoverflow, but I guess since it's specific to Qt 5.0.1 I'd repost here.
    Any help would be greatly appreciated,

    I'm struggling to get a subclass of QGLWidget compiled that uses glew. I'm running Qt 5.0.1 + MinGW 4.7 on Windows 7. Glew 1.7.0 has been compiled with said MinGW.
    I have subclassed QGLWidget with UGGLWidget and included "GL/glew.h" before the QGLWidget includes. When compiling I get 200 Errors about:

    • 'function' redeclared as different kind of symbol
    • conflicting declaration 'typedef'

    So my Question:
    How do I get a subclass of QGLWidget that uses glew compiled under Qt5?

    Further details at "my original post":

  • Hello !

    I havn't used glew with Qt but I know that there are a patch for Qt5.1 that will make it easier to use OpenGL extensions with Qt. It is written by Sean Harmer at KDAB. It's not GLEW but anyway .. Please look at ..,35408

    I hope this helps You ..


  • Thanks Fredrik for the pointers.

    I figured out the problem. Could have done that much faster if I read the compiler errors properly ^^

    When using the provided Qt5SDK for windows I have to add:
    @#define QT_NO_OPENGL_ES_2@

    before each include of QGLWidget.

    Another option would be to rebuild the libraries and use "-opengl desktop" when configuring. "original":

    Basically the GLES2 includes do not get along with glew.h.

    Have a good day,

Log in to reply