Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt5 + VS2012 express + OpenGL + GLEW



  • This code compiles fine in Qt 4.8 with Visual Studio Express 2012
    @
    #define GLEW_STATIC
    #define QT_NO_OPENGL_ES_2

    #include <GL/glew.h>
    #include <QApplication>
    #include <QGLWidget>

    int main(int argc, char** argv){
    glewInit();

    QApplication app(argc, argv);
    QGLWidget widget;
    
    GLuint arr;
    glGenVertexArrays(1, &arr); // added just for testing
    
    widget.show();
    return app.exec&#40;&#41;;
    

    }@

    After upgrading to Qt5 I am not able to make it compile anymore with any of the precompiled libraries available in the download web page.

    Qt5.1.1 VS2012 32 bits
    error C2371: 'GLsizeiptr' : redefinition; different basic types C:\Qt\Qt5.1.0\5.1.0\msvc2012\include\QtANGLE\GLES2\gl2.h
    error C2371: 'GLintptr' : redefinition; different basic types C:\Qt\Qt5.1.0\5.1.0\msvc2012\include\QtANGLE\GLES2\gl2.h
    error C2371: 'GLdouble' : redefinition; different basic types C:\Qt\Qt5.1.0\5.1.0\msvc2012\include\QtGui\qopengl.h
    error C2365: '__glewVertexAttribPointer' : redefinition; previous definition was 'data variable' C:\Qt\Qt5.1.0\5.1.0\msvc2012\include\QtANGLE\GLES2\gl2.h
    error C2365: '__glewVertexAttrib4fv' : redefinition; previous definition was 'data variable' C:\Qt\Qt5.1.0\5.1.0\msvc2012\include\QtANGLE\GLES2\gl2.h

    Qt 5.1.1 VS2010 32 bits + OpenGL
    error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QGLWidget::~QGLWidget(void)"
    error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall QGLWidget::QGLWidget(class QWidget *,class QGLWidget const *,class QFlags<enum Qt::WindowType>)"

    Qt5.1.1 VS2012 64 bits + OpenGL
    error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

    I also tried to compile Qt myself with no success; there are much more dependencies than previous versions making impossible for someone with limited experience.


Log in to reply