Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Where is QOpenGLWidget?
-
I'm trying to write a C++ application that uses QOpenGLWidget, but qtcreator gives "'QOpenGLWidget' file not found" error on this line:
#include <QOpenGLWidget>
Documentation says QOpenGLWidget was introduced in Qt 5.4, and I believe I am running Qt 5.12; 'qmake --version' gives:
QMake version 3.1
Using Qt version 5.12.1 in /home/oreilly/Qt5.12.1/5.12.1/gcc_64/libWhat am I doing wrong?
Thanks
Tom
-
@Tom-asso
What does you .pro file look like?
-
Where is QOpenGLWidget?
It is in the Qt Widgets module. So if
#include <QWidget>
works, then#include <QOpenGLWidget>
should also work.Make sure your .pro file is set to use the Qt Widgets module (something like
QT += widgets
)
-
My .pro file had this entry:
QT += quickI added the following:
QT += openglAnd now qtcreator finds QOpenGLWidget
Thanks
Tom
-
Hi,
As @JKSH already wrote, you are missing
QT += widgets
in your .pro file.