Qt C++ lnk2019 errors with opengl widget
-
wrote on 7 Feb 2023, 13:47 last edited by
every time i added the opengl widget to my form i always gett lnk2019 unresolved external symbol errors and i did add QT += opengl to the pro file
-
every time i added the opengl widget to my form i always gett lnk2019 unresolved external symbol errors and i did add QT += opengl to the pro file
wrote on 7 Feb 2023, 14:11 last edited by JonB 2 Jul 2023, 14:12@Cave1212
Try Googling, e.g. https://stackoverflow.com/questions/39175604/qt-opengl-link-errorLIBS += -lOpenGL32
Not my area, but is that what you need? You don't give us any clue as to which symbols are undefined....
-
@Cave1212
Try Googling, e.g. https://stackoverflow.com/questions/39175604/qt-opengl-link-errorLIBS += -lOpenGL32
Not my area, but is that what you need? You don't give us any clue as to which symbols are undefined....
wrote on 7 Feb 2023, 14:26 last edited by@JonB i added that but i still get errors
bolt.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QOpenGLWidget::QOpenGLWidget(class QWidget *,class QFlags<enum Qt::WindowType>)" (__imp_??0QOpenGLWidget@@QEAA@PEAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z) referenced in function "public: void __cdecl Ui_BOLT::setupUi(class QMainWindow *)" (?setupUi@Ui_BOLT@@QEAAXPEAVQMainWindow@@@Z) debug\BOLT.exe:-1: error: LNK1120: 14 unresolved externals bolt.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl QOpenGLWidget::~QOpenGLWidget(void)" (__imp_??1QOpenGLWidget@@UEAA@XZ) referenced in function "public: virtual void * __cdecl QOpenGLWidget::`scalar deleting destructor'(unsigned int)" (??_GQOpenGLWidget@@UEAAPEAXI@Z) bolt.obj:-1: error: LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __cdecl QOpenGLWidget::metaObject(void)const " (?metaObject@QOpenGLWidget@@UEBAPEBUQMetaObject@@XZ) bolt.obj:-1: error: LNK2001: unresolved external symbol "public: virtual void * __cdecl QOpenGLWidget::qt_metacast(char const *)" (?qt_metacast@QOpenGLWidget@@UEAAPEAXPEBD@Z) bolt.obj:-1: error: LNK2001: unresolved external symbol "public: virtual int __cdecl QOpenGLWidget::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@QOpenGLWidget@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z) bolt.obj:-1: error: LNK2001: unresolved external symbol "protected: virtual void __cdecl QOpenGLWidget::initializeGL(void)" (?initializeGL@QOpenGLWidget@@MEAAXXZ) bolt.obj:-1: error: LNK2001: unresolved external symbol "protected: virtual void __cdecl QOpenGLWidget::resizeGL(int,int)" (?resizeGL@QOpenGLWidget@@MEAAXHH@Z) bolt.obj:-1: error: LNK2001: unresolved external symbol "protected: virtual void __cdecl QOpenGLWidget::paintGL(void)" (?paintGL@QOpenGLWidget@@MEAAXXZ) bolt.obj:-1: error: LNK2001: unresolved external symbol "protected: virtual void __cdecl QOpenGLWidget::paintEvent(class QPaintEvent *)" (?paintEvent@QOpenGLWidget@@MEAAXPEAVQPaintEvent@@@Z) bolt.obj:-1: error: LNK2001: unresolved external symbol "protected: virtual void __cdecl QOpenGLWidget::resizeEvent(class QResizeEvent *)" (?resizeEvent@QOpenGLWidget@@MEAAXPEAVQResizeEvent@@@Z) bolt.obj:-1: error: LNK2001: unresolved external symbol "protected: virtual bool __cdecl QOpenGLWidget::event(class QEvent *)" (?event@QOpenGLWidget@@MEAA_NPEAVQEvent@@@Z) bolt.obj:-1: error: LNK2001: unresolved external symbol "protected: virtual int __cdecl QOpenGLWidget::metric(enum QPaintDevice::PaintDeviceMetric)const " (?metric@QOpenGLWidget@@MEBAHW4PaintDeviceMetric@QPaintDevice@@@Z) bolt.obj:-1: error: LNK2001: unresolved external symbol "protected: virtual class QPaintDevice * __cdecl QOpenGLWidget::redirected(class QPoint *)const " (?redirected@QOpenGLWidget@@MEBAPEAVQPaintDevice@@PEAVQPoint@@@Z) bolt.obj:-1: error: LNK2001: unresolved external symbol "protected: virtual class QPaintEngine * __cdecl QOpenGLWidget::paintEngine(void)const " (?paintEngine@QOpenGLWidget@@MEBAPEAVQPaintEngine@@XZ)
-
@JonB i added that but i still get errors
bolt.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QOpenGLWidget::QOpenGLWidget(class QWidget *,class QFlags<enum Qt::WindowType>)" (__imp_??0QOpenGLWidget@@QEAA@PEAVQWidget@@V?$QFlags@W4WindowType@Qt@@@@@Z) referenced in function "public: void __cdecl Ui_BOLT::setupUi(class QMainWindow *)" (?setupUi@Ui_BOLT@@QEAAXPEAVQMainWindow@@@Z) debug\BOLT.exe:-1: error: LNK1120: 14 unresolved externals bolt.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl QOpenGLWidget::~QOpenGLWidget(void)" (__imp_??1QOpenGLWidget@@UEAA@XZ) referenced in function "public: virtual void * __cdecl QOpenGLWidget::`scalar deleting destructor'(unsigned int)" (??_GQOpenGLWidget@@UEAAPEAXI@Z) bolt.obj:-1: error: LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __cdecl QOpenGLWidget::metaObject(void)const " (?metaObject@QOpenGLWidget@@UEBAPEBUQMetaObject@@XZ) bolt.obj:-1: error: LNK2001: unresolved external symbol "public: virtual void * __cdecl QOpenGLWidget::qt_metacast(char const *)" (?qt_metacast@QOpenGLWidget@@UEAAPEAXPEBD@Z) bolt.obj:-1: error: LNK2001: unresolved external symbol "public: virtual int __cdecl QOpenGLWidget::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@QOpenGLWidget@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z) bolt.obj:-1: error: LNK2001: unresolved external symbol "protected: virtual void __cdecl QOpenGLWidget::initializeGL(void)" (?initializeGL@QOpenGLWidget@@MEAAXXZ) bolt.obj:-1: error: LNK2001: unresolved external symbol "protected: virtual void __cdecl QOpenGLWidget::resizeGL(int,int)" (?resizeGL@QOpenGLWidget@@MEAAXHH@Z) bolt.obj:-1: error: LNK2001: unresolved external symbol "protected: virtual void __cdecl QOpenGLWidget::paintGL(void)" (?paintGL@QOpenGLWidget@@MEAAXXZ) bolt.obj:-1: error: LNK2001: unresolved external symbol "protected: virtual void __cdecl QOpenGLWidget::paintEvent(class QPaintEvent *)" (?paintEvent@QOpenGLWidget@@MEAAXPEAVQPaintEvent@@@Z) bolt.obj:-1: error: LNK2001: unresolved external symbol "protected: virtual void __cdecl QOpenGLWidget::resizeEvent(class QResizeEvent *)" (?resizeEvent@QOpenGLWidget@@MEAAXPEAVQResizeEvent@@@Z) bolt.obj:-1: error: LNK2001: unresolved external symbol "protected: virtual bool __cdecl QOpenGLWidget::event(class QEvent *)" (?event@QOpenGLWidget@@MEAA_NPEAVQEvent@@@Z) bolt.obj:-1: error: LNK2001: unresolved external symbol "protected: virtual int __cdecl QOpenGLWidget::metric(enum QPaintDevice::PaintDeviceMetric)const " (?metric@QOpenGLWidget@@MEBAHW4PaintDeviceMetric@QPaintDevice@@@Z) bolt.obj:-1: error: LNK2001: unresolved external symbol "protected: virtual class QPaintDevice * __cdecl QOpenGLWidget::redirected(class QPoint *)const " (?redirected@QOpenGLWidget@@MEBAPEAVQPaintDevice@@PEAVQPoint@@@Z) bolt.obj:-1: error: LNK2001: unresolved external symbol "protected: virtual class QPaintEngine * __cdecl QOpenGLWidget::paintEngine(void)const " (?paintEngine@QOpenGLWidget@@MEBAPEAVQPaintEngine@@XZ)
wrote on 7 Feb 2023, 14:33 last edited by@Cave1212
That looks like every singleQOpenGLWidget
class/method reference? Somebody may have a better suggestion than I, but I would look at the actual linker command line being issued from Creator/qmake to see what it does/does not have for OpenGL libraries. -
Lifetime Qt Championwrote on 7 Feb 2023, 16:33 last edited by Chris Kawa 2 Jul 2023, 16:35
Add
QT += openglwidgets
.
OpenGL support and widgets are in separate modules.Btw. if you ever get linker errors about Qt classes you can go to their doc page and at the top it's listed which module they are in.
-
Add
QT += openglwidgets
.
OpenGL support and widgets are in separate modules.Btw. if you ever get linker errors about Qt classes you can go to their doc page and at the top it's listed which module they are in.
wrote on 20 Aug 2023, 15:51 last edited byThis post is deleted! -
Add
QT += openglwidgets
.
OpenGL support and widgets are in separate modules.Btw. if you ever get linker errors about Qt classes you can go to their doc page and at the top it's listed which module they are in.
wrote on 21 Aug 2023, 13:39 last edited byThis post is deleted! -
This post is deleted!
@mateuszusd said in Qt C++ lnk2019 errors with opengl widget:
What should do to solve this problem in visual studio2022
What was already suggested