Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt C++ lnk2019 errors with opengl widget
Forum Update on Monday, May 27th 2025

Qt C++ lnk2019 errors with opengl widget

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 5 Posters 1.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Cave1212
    wrote on 7 Feb 2023, 13:47 last edited by
    #1

    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

    J 1 Reply Last reply 7 Feb 2023, 14:11
    0
    • C Cave1212
      7 Feb 2023, 13:47

      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

      J Offline
      J Offline
      JonB
      wrote on 7 Feb 2023, 14:11 last edited by JonB 2 Jul 2023, 14:12
      #2

      @Cave1212
      Try Googling, e.g. https://stackoverflow.com/questions/39175604/qt-opengl-link-error

      LIBS += -lOpenGL32

      Not my area, but is that what you need? You don't give us any clue as to which symbols are undefined....

      C 1 Reply Last reply 7 Feb 2023, 14:26
      0
      • J JonB
        7 Feb 2023, 14:11

        @Cave1212
        Try Googling, e.g. https://stackoverflow.com/questions/39175604/qt-opengl-link-error

        LIBS += -lOpenGL32

        Not my area, but is that what you need? You don't give us any clue as to which symbols are undefined....

        C Offline
        C Offline
        Cave1212
        wrote on 7 Feb 2023, 14:26 last edited by
        #3

        @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)
        
        J 1 Reply Last reply 7 Feb 2023, 14:33
        0
        • C Cave1212
          7 Feb 2023, 14:26

          @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)
          
          J Offline
          J Offline
          JonB
          wrote on 7 Feb 2023, 14:33 last edited by
          #4

          @Cave1212
          That looks like every single QOpenGLWidget 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.

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on 7 Feb 2023, 16:33 last edited by Chris Kawa 2 Jul 2023, 16:35
            #5

            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.

            M 2 Replies Last reply 20 Aug 2023, 15:51
            2
            • C Chris Kawa
              7 Feb 2023, 16:33

              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.

              M Offline
              M Offline
              mateuszusd
              wrote on 20 Aug 2023, 15:51 last edited by
              #6
              This post is deleted!
              1 Reply Last reply
              0
              • C Chris Kawa
                7 Feb 2023, 16:33

                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.

                M Offline
                M Offline
                mateuszusd
                wrote on 21 Aug 2023, 13:39 last edited by
                #7
                This post is deleted!
                J 1 Reply Last reply 21 Aug 2023, 13:49
                0
                • M mateuszusd
                  21 Aug 2023, 13:39

                  This post is deleted!

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 21 Aug 2023, 13:49 last edited by
                  #8

                  @mateuszusd said in Qt C++ lnk2019 errors with opengl widget:

                  What should do to solve this problem in visual studio2022

                  What was already suggested

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved