Important: Please read the Qt Code of Conduct -

Cannot compile simple Opengl 4.3 program

  • Hello everyone, and thanks for your valuable time :-)

    I used to develop with Visual 2012 (Windows 7), using SDL 2 + glew, to compile Opengl 4 programs (making a game engine), and it worked just fine.

    To improve this engine, I decided to do some WYSIWYG ("what you see is what you get"), so I naturally learned Qt (5.2) as it is the most powerful framework to deal with GUI/OpenGL integration. So far, I love this framework ;-)

    But now, I start tryng to compile the simplest OpenGL 4.3 program with QtCreator, and I cannot get it to work.
    What I have done by now is:
    -> Subclass QWindow
    -> Set surface type, creates context, and bind context with window
    -> And the source of the error : try to resolve GL functions with "QOpenGLFunctions_4_3_Core" class

    It does not work because the compiler does not know "QOpenGLFunctions_4_3_Core" type... I found out that the macro "QT_OPENGL_ES_2" is defined in "qopenglfunctions_4_3_core.h", which disable "QOpenGLFunctions_4_3_Core" class declaration.
    Even if I use "DEFINES += QT_NO_OPENGL_ES_2 " in the .pro, there are strange behavior : the syntax now highlights the "QOpenGLFunctions_4_3_Core" type and functions, but compiler still fails (it still does not recognize the type...)

    Has someone here managed to compile and run an OpenGl program with version 4.3 ? (using QWindow, or whatever other methods...) ? I cannot find tutorial on thenet to help, except this one "", which lead me here :-|

    Many thanks for your help

  • I found the problem : I installed the Qt 5.2 installer for Windows 7 - Visual 2012 - 32 bits, which does not incude OpenGL components.

    After downloading the 64 bits version - Windows 7 - Visual 2012 - OpenGL, it runs just fine ;-)

  • welcome to devnet

    Good to know that you have solved it all by yourself.

    -I will mark your post as solved in the header line.- You can do that -also by yourself- while editing the first port and change the title line.

  • Actually, I cannot do that for you. Please edit first post and introduce "[solved]". This helps others to find that there might be an answer for their problem.

Log in to reply