Important: Please read the Qt Code of Conduct -

QOpenGLPaintDevice is undefined for Qt 5.9 on MSVC 2015

  • I am trying to enable OpenGL-based painting in QCustomPlot. My class derives from QCustomPlot and then adds the data to draw line graphs. This works fine when creating a DLL after:

    1. Defining the QCUSTOMPLOT_USE_OPENGL pre-processor symbol.
    2. Un-defining QT_NO_OPENGL pre-processor symbol.
    3. Adding opengl32.lib to the linker line.

    However, the headers of the above project are included in another project (same solution) and the DLL is added to the project reference, but compiler says
    error C2065: 'QOpenGLPaintDevice': undeclared identifier
    when compiling the second project.

    From what I can understand is that the class is not available if QT_NO_OPENGL is defined. My question is where is the definition being included from? Even after adding #undef QT_NO_OPENGL to all the projects, I still have the error in the second project.

  • Lifetime Qt Champion


    Are you trying to build your project with a version of Qt that has been build with OpenGL disabled ?

  • I solved the issue, cleaning everything up and rebuilding the solution did it. I now have a new problem with OpenGL enabled. Shall post a new question. Thank you!

Log in to reply