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 Updated to NodeBB v4.3 + New Features

Qt C++ lnk2019 errors with opengl widget

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 5 Posters 1.9k Views 1 Watching
  • 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 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

    JonBJ 1 Reply Last reply
    0
    • C Cave1212

      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

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by JonB
      #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
      0
      • JonBJ JonB

        @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 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)
        
        JonBJ 1 Reply Last reply
        0
        • C Cave1212

          @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)
          
          JonBJ Online
          JonBJ Online
          JonB
          wrote on 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
          • Chris KawaC Offline
            Chris KawaC Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on last edited by Chris Kawa
            #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
            2
            • Chris KawaC Chris Kawa

              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 last edited by
              #6
              This post is deleted!
              1 Reply Last reply
              0
              • Chris KawaC Chris Kawa

                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 last edited by
                #7
                This post is deleted!
                jsulmJ 1 Reply Last reply
                0
                • M mateuszusd

                  This post is deleted!

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 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