Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. Qt6 OpenGL Static Release. Error: qopenglpaintengine.cpp:-1: error: undefined reference to `__imp_glMatrixMode'

Qt6 OpenGL Static Release. Error: qopenglpaintengine.cpp:-1: error: undefined reference to `__imp_glMatrixMode'

Scheduled Pinned Locked Moved Unsolved Qt 6
34 Posts 6 Posters 5.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.
  • 8 Offline
    8 Offline
    8Observer8
    wrote on 5 Jun 2022, 13:55 last edited by 8Observer8 6 May 2022, 13:59
    #1

    Hello,

    I have Qt 6.2.0 MinGW 64bit with a static build. The dynamic debug build works fine (as the dynamic release) but the static release build does not work:

    qopenglpaintengine.cpp:-1: error: undefined reference to `__imp_glMatrixMode'
    qopenglpaintengine.cpp:-1: error: undefined reference to `__imp_glLoadIdentity'
    qopenglpaintengine.cpp:-1: error: undefined reference to `__imp_glOrtho'
    qopenglpaintengine.cpp:-1: error: undefined reference to `__imp_glLoadMatrixf'
    

    d86f46c4-9e37-49fa-9e85-7c016e2f1307-image.png

    I use QOpenGLFunctions:

    .pro:

    QT       += core gui openglwidgets
    
    win32: LIBS += -lopengl32
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    CONFIG += c++11
    
    # You can make your code fail to compile if it uses deprecated APIs.
    # In order to do so, uncomment the following line.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    SOURCES += \
        main.cpp \
        Widget.cpp
    
    HEADERS += \
        Widget.h
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    
    RESOURCES += \
        Shaders.qrc
    

    main.cpp

    #ifdef _WIN32
    #include <windows.h>
    extern "C" __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
    extern "C" __declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001;
    #endif
    #include "Widget.h"
    
    #include <QtWidgets/QApplication>
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        Widget w;
        w.show();
        return a.exec();
    }
    

    Widget.h

    #ifndef WIDGET_H
    #define WIDGET_H
    
    #include <QtOpenGLWidgets/QOpenGLWidget>
    #include <QtGui/QOpenGLFunctions>
    
    class Widget : public QOpenGLWidget, QOpenGLFunctions
    {
        Q_OBJECT
    
    public:
        Widget(QWidget *parent = nullptr);
        ~Widget();
    
    private:
        void initializeGL() override;
        void paintGL() override;
        void resizeGL(int w, int h) override;
    };
    #endif // WIDGET_H
    

    Widget.cpp

    #include "Widget.h"
    
    Widget::Widget(QWidget *parent)
        : QOpenGLWidget(parent)
    {
        resize(500, 500);
        setWindowTitle("Qt6 C++, OpenGL ES 2.0");
    }
    
    Widget::~Widget()
    {
    }
    
    void Widget::initializeGL()
    {
        initializeOpenGLFunctions();
        glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
    }
    
    void Widget::paintGL()
    {
        glClear(GL_COLOR_BUFFER_BIT);
    }
    
    void Widget::resizeGL(int w, int h)
    {
        glViewport(0, 0, w, h);
    }
    
    1 Reply Last reply
    0
    • N Offline
      N Offline
      nicker player
      wrote on 17 Jun 2022, 02:27 last edited by
      #2

      you dont have the right lib file path in ur pro file
      just check it very carefully ,u'll find the secret of the way

      8 1 Reply Last reply 3 Sept 2022, 05:20
      0
      • N nicker player
        17 Jun 2022, 02:27

        you dont have the right lib file path in ur pro file
        just check it very carefully ,u'll find the secret of the way

        8 Offline
        8 Offline
        8Observer8
        wrote on 3 Sept 2022, 05:20 last edited by 8Observer8 9 Mar 2022, 15:49
        #3

        @nicker-player said in Qt6 OpenGL Static Release. Error: qopenglpaintengine.cpp:-1: error: undefined reference to &#x60;__imp_glMatrixMode':

        you dont have the right lib file path in ur pro file

        Which path? But why does the dynamic version work?

        1 Reply Last reply
        0
        • C Online
          C Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 3 Sept 2022, 06:17 last edited by
          #4

          glMatruxMode is defined in OpenGL32.dll so you have to link against OpenGL32.lib as described in the documentation.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          0
          • 8 Offline
            8 Offline
            8Observer8
            wrote on 3 Sept 2022, 06:36 last edited by 8Observer8 9 Mar 2022, 06:36
            #5

            @Christian-Ehrlicher how to link OpenGL32.lib? What must I write in pro file?

            C 1 Reply Last reply 3 Sept 2022, 07:25
            0
            • 8 8Observer8
              3 Sept 2022, 06:36

              @Christian-Ehrlicher how to link OpenGL32.lib? What must I write in pro file?

              C Online
              C Online
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on 3 Sept 2022, 07:25 last edited by
              #6

              @8Observer8 said in Qt6 OpenGL Static Release. Error: qopenglpaintengine.cpp:-1: error: undefined reference to &#x60;__imp_glMatrixMode':

              What must I write in pro file?

              LIBS

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              0
              • 8 Offline
                8 Offline
                8Observer8
                wrote on 3 Sept 2022, 07:35 last edited by 8Observer8 9 Mar 2022, 08:04
                #7

                @Christian-Ehrlicher as you can see in my first post I have written in my pro file:

                win32: LIBS += -lopengl32
                
                C 1 Reply Last reply 3 Sept 2022, 14:46
                0
                • 8 Offline
                  8 Offline
                  8Observer8
                  wrote on 3 Sept 2022, 08:00 last edited by 8Observer8 9 Mar 2022, 08:02
                  #8

                  Maybe should I include -opengl (or something like this) to config command before the static build?

                  configure -prefix "C:\Qt6.2.0_Static" -static -static-runtime -release -opensource -confirm-license -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -sql-odbc -sql-sqlite -nomake tools -nomake examples -nomake tests -skip qttools -skip qtquick3d -skip qt5compat -skip qtquicktimeline -skip qtwebengine -skip qtactiveqt -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtimageformats -skip qtlottie -skip qtnetworkauth -skip qtremoteobjects -skip qtvirtualkeyboard -skip qtserialbus -skip qtserialport -skip qtwebchannel -skip qtwebview -skip qtwayland -skip qtscxml -skip qtmqtt -skip qtopcua -skip qtsvg -skip qtdoc -skip qttranslations

                  8 1 Reply Last reply 3 Sept 2022, 16:58
                  0
                  • 8 8Observer8
                    3 Sept 2022, 07:35

                    @Christian-Ehrlicher as you can see in my first post I have written in my pro file:

                    win32: LIBS += -lopengl32
                    
                    C Online
                    C Online
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on 3 Sept 2022, 14:46 last edited by
                    #9

                    @8Observer8 said in Qt6 OpenGL Static Release. Error: qopenglpaintengine.cpp:-1: error: undefined reference to &#x60;__imp_glMatrixMode':

                    as you can see in my first post I have written in my pro file:
                    win32: LIBS += -lopengl32

                    Then make sure this also appears in your linker line when linking the executable.

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    1 Reply Last reply
                    0
                    • 8 Offline
                      8 Offline
                      8Observer8
                      wrote on 3 Sept 2022, 15:27 last edited by 8Observer8 9 Mar 2022, 15:33
                      #10

                      I see -lopengl32 in this line: C:\Qt6.2.0_Static\lib\objects-Release\QWindowsIntegrationPlugin_resources_2\.rcc\qrc_cursors.cpp.obj -limm32 -loleaut32 -lshlwapi -lwinspool -lwtsapi32 -lopengl32

                      Full log:

                      19:22:52: Configuration unchanged, skipping qmake step.
                      19:22:52: Starting: "C:\Qt6\Tools\mingw810_64\bin\mingw32-make.exe" -j4
                      C:\Qt6.2.0_Static\bin\qmake.exe -o Makefile ..\..\createjs\simple-platformer-dev\Jumps_Box2DOpenGL2_Qt6Cpp\Jumps_Box2DOpenGL2_Qt6Cpp.pro -spec win32-g++ "CONFIG+=qtquickcompiler"
                      C:/Qt6/Tools/mingw810_64/bin/mingw32-make -f Makefile.Release
                      mingw32-make[1]: Entering directory 'E:/_Projects/builds/build-Jumps_Box2DOpenGL2_Qt6Cpp-Desktop_Qt_6_2_0_Static_MinGW_64_bit-Release'
                      g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG -DQT_OPENGLWIDGETS_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../../createjs/simple-platformer-dev/Jumps_Box2DOpenGL2_Qt6Cpp -I. -I"C:/Program Files/FMOD SoundSystem/FMOD Studio API Windows/api/core/inc" -I../../../Libs/box2d-2.4.1-mingw-64-bit/include -IC:/Qt6.2.0_Static/include -IC:/Qt6.2.0_Static/include/QtOpenGLWidgets -IC:/Qt6.2.0_Static/include/QtOpenGL -IC:/Qt6.2.0_Static/include/QtWidgets -IC:/Qt6.2.0_Static/include/QtGui -IC:/Qt6.2.0_Static/include/QtCore -Irelease -IC:/Qt6.2.0_Static/mkspecs/win32-g++  -o release\main.o ..\..\createjs\simple-platformer-dev\Jumps_Box2DOpenGL2_Qt6Cpp\main.cpp
                      g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG -DQT_OPENGLWIDGETS_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../../createjs/simple-platformer-dev/Jumps_Box2DOpenGL2_Qt6Cpp -I. -I"C:/Program Files/FMOD SoundSystem/FMOD Studio API Windows/api/core/inc" -I../../../Libs/box2d-2.4.1-mingw-64-bit/include -IC:/Qt6.2.0_Static/include -IC:/Qt6.2.0_Static/include/QtOpenGLWidgets -IC:/Qt6.2.0_Static/include/QtOpenGL -IC:/Qt6.2.0_Static/include/QtWidgets -IC:/Qt6.2.0_Static/include/QtGui -IC:/Qt6.2.0_Static/include/QtCore -Irelease -IC:/Qt6.2.0_Static/mkspecs/win32-g++  -o release\Widget.o ..\..\createjs\simple-platformer-dev\Jumps_Box2DOpenGL2_Qt6Cpp\Widget.cpp
                      C:\Qt6.2.0_Static\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG -DQT_OPENGLWIDGETS_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN --include E:/_Projects/builds/build-Jumps_Box2DOpenGL2_Qt6Cpp-Desktop_Qt_6_2_0_Static_MinGW_64_bit-Release/release/moc_predefs.h -IC:/Qt6.2.0_Static/mkspecs/win32-g++ -IE:/_Projects/createjs/simple-platformer-dev/Jumps_Box2DOpenGL2_Qt6Cpp -I"C:/Program Files/FMOD SoundSystem/FMOD Studio API Windows/api/core/inc" -IE:/Libs/box2d-2.4.1-mingw-64-bit/include -IC:/Qt6.2.0_Static/include -IC:/Qt6.2.0_Static/include/QtOpenGLWidgets -IC:/Qt6.2.0_Static/include/QtOpenGL -IC:/Qt6.2.0_Static/include/QtWidgets -IC:/Qt6.2.0_Static/include/QtGui -IC:/Qt6.2.0_Static/include/QtCore -I. -IC:/Qt6/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++ -IC:/Qt6/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32 -IC:/Qt6/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward -IC:/Qt6/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include -IC:/Qt6/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed -IC:/Qt6/Tools/mingw810_64/x86_64-w64-mingw32/include ..\..\createjs\simple-platformer-dev\Jumps_Box2DOpenGL2_Qt6Cpp\Widget.h -o release\moc_Widget.cpp
                      ..\..\createjs\simple-platformer-dev\Jumps_Box2DOpenGL2_Qt6Cpp\main.cpp:3:40: warning: 'NvOptimusEnablement' initialized and declared 'extern'
                       extern "C" __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
                                                              ^~~~~~~~~~~~~~~~~~~
                      ..\..\createjs\simple-platformer-dev\Jumps_Box2DOpenGL2_Qt6Cpp\main.cpp:4:40: warning: 'AmdPowerXpressRequestHighPerformance' initialized and declared 'extern'
                       extern "C" __declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001;
                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG -DQT_OPENGLWIDGETS_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../../createjs/simple-platformer-dev/Jumps_Box2DOpenGL2_Qt6Cpp -I. -I"C:/Program Files/FMOD SoundSystem/FMOD Studio API Windows/api/core/inc" -I../../../Libs/box2d-2.4.1-mingw-64-bit/include -IC:/Qt6.2.0_Static/include -IC:/Qt6.2.0_Static/include/QtOpenGLWidgets -IC:/Qt6.2.0_Static/include/QtOpenGL -IC:/Qt6.2.0_Static/include/QtWidgets -IC:/Qt6.2.0_Static/include/QtGui -IC:/Qt6.2.0_Static/include/QtCore -Irelease -IC:/Qt6.2.0_Static/mkspecs/win32-g++  -o release\moc_Widget.o release\moc_Widget.cpp
                      g++ -Wl,-s -static -Wl,-subsystem,windows -mthreads -o release\Jumps_Box2DOpenGL2_Qt6Cpp.exe @object_script.Jumps_Box2DOpenGL2_Qt6Cpp.Release  "C:\Program Files\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x64\fmod.dll" -LE:\Libs\box2d-2.4.1-mingw-64-bit\lib -lbox2d C:\Qt6.2.0_Static\plugins\styles\libqwindowsvistastyle.a C:\Qt6.2.0_Static\plugins\platforms\libqwindows.a C:\Qt6.2.0_Static\lib\objects-Release\QWindowsIntegrationPlugin_resources_1\.rcc\qrc_openglblacklists.cpp.obj C:\Qt6.2.0_Static\lib\objects-Release\QWindowsIntegrationPlugin_resources_2\.rcc\qrc_cursors.cpp.obj -limm32 -loleaut32 -lshlwapi -lwinspool -lwtsapi32 -lopengl32 C:\Qt6.2.0_Static\plugins\imageformats\libqgif.a C:\Qt6.2.0_Static\plugins\imageformats\libqico.a C:\Qt6.2.0_Static\plugins\imageformats\libqjpeg.a C:\Qt6.2.0_Static\lib\libQt6OpenGLWidgets.a C:\Qt6.2.0_Static\lib\libQt6OpenGL.a C:\Qt6.2.0_Static\lib\libQt6Widgets.a C:\Qt6.2.0_Static\lib\objects-Release\Widgets_resources_1\.rcc\qrc_qstyle.cpp.obj C:\Qt6.2.0_Static\lib\objects-Release\Widgets_resources_2\.rcc\qrc_qstyle1.cpp.obj C:\Qt6.2.0_Static\lib\objects-Release\Widgets_resources_3\.rcc\qrc_qmessagebox.cpp.obj -ldwmapi -luxtheme C:\Qt6.2.0_Static\lib\libQt6Gui.a C:\Qt6.2.0_Static\lib\objects-Release\Gui_resources_1\.rcc\qrc_qpdf.cpp.obj -ld3d11 -ldxgi -ldxguid -lgdi32 C:\Qt6.2.0_Static\lib\libQt6BundledHarfbuzz.a C:\Qt6.2.0_Static\lib\libQt6BundledFreetype.a C:\Qt6.2.0_Static\lib\libQt6BundledLibpng.a -ld2d1 -ldwrite C:\Qt6.2.0_Static\lib\libQt6Core.a -lsynchronization -lmpr -luserenv -ladvapi32 -lkernel32 -lnetapi32 -lole32 -lshell32 -luser32 -luuid -lversion -lwinmm -lws2_32 C:\Qt6.2.0_Static\lib\libQt6BundledPcre2.a -lmingw32 C:\Qt6.2.0_Static\lib\libQt6EntryPoint.a -lshell32  
                      C:\Qt6.2.0_Static\lib\libQt6OpenGL.a(qopenglpaintengine.cpp.obj):qopenglpaintengine.cpp:(.text$_ZN21QOpenGL2PaintEngineEx19beginNativePaintingEv+0x166): undefined reference to `__imp_glMatrixMode'
                      C:\Qt6.2.0_Static\lib\libQt6OpenGL.a(qopenglpaintengine.cpp.obj):qopenglpaintengine.cpp:(.text$_ZN21QOpenGL2PaintEngineEx19beginNativePaintingEv+0x171): undefined reference to `__imp_glLoadIdentity'
                      C:\Qt6.2.0_Static\lib\libQt6OpenGL.a(qopenglpaintengine.cpp.obj):qopenglpaintengine.cpp:(.text$_ZN21QOpenGL2PaintEngineEx19beginNativePaintingEv+0x1b3): undefined reference to `__imp_glOrtho'
                      C:\Qt6.2.0_Static\lib\libQt6OpenGL.a(qopenglpaintengine.cpp.obj):qopenglpaintengine.cpp:(.text$_ZN21QOpenGL2PaintEngineEx19beginNativePaintingEv+0x1c3): undefined reference to `__imp_glLoadMatrixf'
                      collect2.exe: error: ld returned 1 exit status
                      mingw32-make[1]: *** [Makefile.Release:94: release/Jumps_Box2DOpenGL2_Qt6Cpp.exe] Error 1
                      mingw32-make: *** [Makefile:45: release] Error 2
                      mingw32-make[1]: Leaving directory 'E:/_Projects/builds/build-Jumps_Box2DOpenGL2_Qt6Cpp-Desktop_Qt_6_2_0_Static_MinGW_64_bit-Release'
                      19:23:49: The process "C:\Qt6\Tools\mingw810_64\bin\mingw32-make.exe" exited with code 2.
                      Error while building/deploying project Jumps_Box2DOpenGL2_Qt6Cpp (kit: Desktop Qt 6.2.0 Static MinGW 64-bit)
                      When executing step "Make"
                      19:23:49: Elapsed time: 00:57.
                      

                      Another formatting:

                      19:22:52: Running steps for project Jumps_Box2DOpenGL2_Qt6Cpp... 19:22:52: Configuration unchanged, skipping qmake step. 19:22:52: Starting: "C:\Qt6\Tools\mingw810_64\bin\mingw32-make.exe" -j4 C:\Qt6.2.0_Static\bin\qmake.exe -o Makefile ..\..\createjs\simple-platformer-dev\Jumps_Box2DOpenGL2_Qt6Cpp\Jumps_Box2DOpenGL2_Qt6Cpp.pro -spec win32-g++ "CONFIG+=qtquickcompiler" C:/Qt6/Tools/mingw810_64/bin/mingw32-make -f Makefile.Release mingw32-make[1]: Entering directory 'E:/_Projects/builds/build-Jumps_Box2DOpenGL2_Qt6Cpp-Desktop_Qt_6_2_0_Static_MinGW_64_bit-Release' g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG -DQT_OPENGLWIDGETS_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../../createjs/simple-platformer-dev/Jumps_Box2DOpenGL2_Qt6Cpp -I. -I"C:/Program Files/FMOD SoundSystem/FMOD Studio API Windows/api/core/inc" -I../../../Libs/box2d-2.4.1-mingw-64-bit/include -IC:/Qt6.2.0_Static/include -IC:/Qt6.2.0_Static/include/QtOpenGLWidgets -IC:/Qt6.2.0_Static/include/QtOpenGL -IC:/Qt6.2.0_Static/include/QtWidgets -IC:/Qt6.2.0_Static/include/QtGui -IC:/Qt6.2.0_Static/include/QtCore -Irelease -IC:/Qt6.2.0_Static/mkspecs/win32-g++ -o release\main.o ..\..\createjs\simple-platformer-dev\Jumps_Box2DOpenGL2_Qt6Cpp\main.cpp g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG -DQT_OPENGLWIDGETS_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../../createjs/simple-platformer-dev/Jumps_Box2DOpenGL2_Qt6Cpp -I. -I"C:/Program Files/FMOD SoundSystem/FMOD Studio API Windows/api/core/inc" -I../../../Libs/box2d-2.4.1-mingw-64-bit/include -IC:/Qt6.2.0_Static/include -IC:/Qt6.2.0_Static/include/QtOpenGLWidgets -IC:/Qt6.2.0_Static/include/QtOpenGL -IC:/Qt6.2.0_Static/include/QtWidgets -IC:/Qt6.2.0_Static/include/QtGui -IC:/Qt6.2.0_Static/include/QtCore -Irelease -IC:/Qt6.2.0_Static/mkspecs/win32-g++ -o release\Widget.o ..\..\createjs\simple-platformer-dev\Jumps_Box2DOpenGL2_Qt6Cpp\Widget.cpp C:\Qt6.2.0_Static\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG -DQT_OPENGLWIDGETS_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN --include E:/_Projects/builds/build-Jumps_Box2DOpenGL2_Qt6Cpp-Desktop_Qt_6_2_0_Static_MinGW_64_bit-Release/release/moc_predefs.h -IC:/Qt6.2.0_Static/mkspecs/win32-g++ -IE:/_Projects/createjs/simple-platformer-dev/Jumps_Box2DOpenGL2_Qt6Cpp -I"C:/Program Files/FMOD SoundSystem/FMOD Studio API Windows/api/core/inc" -IE:/Libs/box2d-2.4.1-mingw-64-bit/include -IC:/Qt6.2.0_Static/include -IC:/Qt6.2.0_Static/include/QtOpenGLWidgets -IC:/Qt6.2.0_Static/include/QtOpenGL -IC:/Qt6.2.0_Static/include/QtWidgets -IC:/Qt6.2.0_Static/include/QtGui -IC:/Qt6.2.0_Static/include/QtCore -I. -IC:/Qt6/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++ -IC:/Qt6/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32 -IC:/Qt6/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward -IC:/Qt6/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include -IC:/Qt6/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed -IC:/Qt6/Tools/mingw810_64/x86_64-w64-mingw32/include ..\..\createjs\simple-platformer-dev\Jumps_Box2DOpenGL2_Qt6Cpp\Widget.h -o release\moc_Widget.cpp ..\..\createjs\simple-platformer-dev\Jumps_Box2DOpenGL2_Qt6Cpp\main.cpp:3:40: warning: 'NvOptimusEnablement' initialized and declared 'extern' extern "C" __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; ^~~~~~~~~~~~~~~~~~~ ..\..\createjs\simple-platformer-dev\Jumps_Box2DOpenGL2_Qt6Cpp\main.cpp:4:40: warning: 'AmdPowerXpressRequestHighPerformance' initialized and declared 'extern' extern "C" __declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ g++ -c -fno-keep-inline-dllexport -O2 -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG -DQT_OPENGLWIDGETS_LIB -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../../createjs/simple-platformer-dev/Jumps_Box2DOpenGL2_Qt6Cpp -I. -I"C:/Program Files/FMOD SoundSystem/FMOD Studio API Windows/api/core/inc" -I../../../Libs/box2d-2.4.1-mingw-64-bit/include -IC:/Qt6.2.0_Static/include -IC:/Qt6.2.0_Static/include/QtOpenGLWidgets -IC:/Qt6.2.0_Static/include/QtOpenGL -IC:/Qt6.2.0_Static/include/QtWidgets -IC:/Qt6.2.0_Static/include/QtGui -IC:/Qt6.2.0_Static/include/QtCore -Irelease -IC:/Qt6.2.0_Static/mkspecs/win32-g++ -o release\moc_Widget.o release\moc_Widget.cpp g++ -Wl,-s -static -Wl,-subsystem,windows -mthreads -o release\Jumps_Box2DOpenGL2_Qt6Cpp.exe @object_script.Jumps_Box2DOpenGL2_Qt6Cpp.Release "C:\Program Files\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x64\fmod.dll" -LE:\Libs\box2d-2.4.1-mingw-64-bit\lib -lbox2d C:\Qt6.2.0_Static\plugins\styles\libqwindowsvistastyle.a C:\Qt6.2.0_Static\plugins\platforms\libqwindows.a C:\Qt6.2.0_Static\lib\objects-Release\QWindowsIntegrationPlugin_resources_1\.rcc\qrc_openglblacklists.cpp.obj C:\Qt6.2.0_Static\lib\objects-Release\QWindowsIntegrationPlugin_resources_2\.rcc\qrc_cursors.cpp.obj -limm32 -loleaut32 -lshlwapi -lwinspool -lwtsapi32 -lopengl32 C:\Qt6.2.0_Static\plugins\imageformats\libqgif.a C:\Qt6.2.0_Static\plugins\imageformats\libqico.a C:\Qt6.2.0_Static\plugins\imageformats\libqjpeg.a C:\Qt6.2.0_Static\lib\libQt6OpenGLWidgets.a C:\Qt6.2.0_Static\lib\libQt6OpenGL.a C:\Qt6.2.0_Static\lib\libQt6Widgets.a C:\Qt6.2.0_Static\lib\objects-Release\Widgets_resources_1\.rcc\qrc_qstyle.cpp.obj C:\Qt6.2.0_Static\lib\objects-Release\Widgets_resources_2\.rcc\qrc_qstyle1.cpp.obj C:\Qt6.2.0_Static\lib\objects-Release\Widgets_resources_3\.rcc\qrc_qmessagebox.cpp.obj -ldwmapi -luxtheme C:\Qt6.2.0_Static\lib\libQt6Gui.a C:\Qt6.2.0_Static\lib\objects-Release\Gui_resources_1\.rcc\qrc_qpdf.cpp.obj -ld3d11 -ldxgi -ldxguid -lgdi32 C:\Qt6.2.0_Static\lib\libQt6BundledHarfbuzz.a C:\Qt6.2.0_Static\lib\libQt6BundledFreetype.a C:\Qt6.2.0_Static\lib\libQt6BundledLibpng.a -ld2d1 -ldwrite C:\Qt6.2.0_Static\lib\libQt6Core.a -lsynchronization -lmpr -luserenv -ladvapi32 -lkernel32 -lnetapi32 -lole32 -lshell32 -luser32 -luuid -lversion -lwinmm -lws2_32 C:\Qt6.2.0_Static\lib\libQt6BundledPcre2.a -lmingw32 C:\Qt6.2.0_Static\lib\libQt6EntryPoint.a -lshell32 C:\Qt6.2.0_Static\lib\libQt6OpenGL.a(qopenglpaintengine.cpp.obj):qopenglpaintengine.cpp:(.text$_ZN21QOpenGL2PaintEngineEx19beginNativePaintingEv+0x166): undefined reference to __imp_glMatrixMode'
                      C:\Qt6.2.0_Static\lib\libQt6OpenGL.a(qopenglpaintengine.cpp.obj):qopenglpaintengine.cpp:(.text$_ZN21QOpenGL2PaintEngineEx19beginNativePaintingEv+0x171): undefined reference to __imp_glLoadIdentity' C:\Qt6.2.0_Static\lib\libQt6OpenGL.a(qopenglpaintengine.cpp.obj):qopenglpaintengine.cpp:(.text$_ZN21QOpenGL2PaintEngineEx19beginNativePaintingEv+0x1b3): undefined reference to __imp_glOrtho'
                      C:\Qt6.2.0_Static\lib\libQt6OpenGL.a(qopenglpaintengine.cpp.obj):qopenglpaintengine.cpp:(.text$_ZN21QOpenGL2PaintEngineEx19beginNativePaintingEv+0x1c3): undefined reference to __imp_glLoadMatrixf' collect2.exe: error: ld returned 1 exit status mingw32-make[1]: *** [Makefile.Release:94: release/Jumps_Box2DOpenGL2_Qt6Cpp.exe] Error 1 mingw32-make: *** [Makefile:45: release] Error 2 mingw32-make[1]: Leaving directory 'E:/_Projects/builds/build-Jumps_Box2DOpenGL2_Qt6Cpp-Desktop_Qt_6_2_0_Static_MinGW_64_bit-Release' 19:23:49: The process "C:\Qt6\Tools\mingw810_64\bin\mingw32-make.exe" exited with code 2. Error while building/deploying project Jumps_Box2DOpenGL2_Qt6Cpp (kit: Desktop Qt 6.2.0 Static MinGW 64-bit) When executing step "Make" 19:23:49: Elapsed time: 00:57.

                      1 Reply Last reply
                      0
                      • C Online
                        C Online
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on 3 Sept 2022, 15:33 last edited by
                        #11

                        Ok - please take a look at this answer: https://stackoverflow.com/questions/9336263/glfw-undefined-references

                        Looks like MinGW split up the libs different to MSVC.

                        Also you can try to move -lopengl32 after all the other libs (for testing purposes directly on the command line)

                        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                        Visit the Qt Academy at https://academy.qt.io/catalog

                        1 Reply Last reply
                        0
                        • 8 Offline
                          8 Offline
                          8Observer8
                          wrote on 3 Sept 2022, 15:54 last edited by 8Observer8 9 Mar 2022, 15:55
                          #12

                          I tried to delete this line win32: LIBS += -lopengl32:

                          QT       += core gui openglwidgets
                          
                          INCLUDEPATH += "C:\Program Files\FMOD SoundSystem\FMOD Studio API Windows\api\core\inc"
                          LIBS += "C:\Program Files\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x64\fmod.dll"
                          
                          INCLUDEPATH += "E:\Libs\box2d-2.4.1-mingw-64-bit\include"
                          LIBS += -L"E:\Libs\box2d-2.4.1-mingw-64-bit\lib"
                          LIBS += -lbox2d
                          
                          greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
                          
                          CONFIG += c++11
                          
                          # You can make your code fail to compile if it uses deprecated APIs.
                          # In order to do so, uncomment the following line.
                          #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                          
                          SOURCES += \
                              ColliderEdge.cpp \
                              DebugDrawer.cpp \
                              VertexBuffers.cpp \
                              main.cpp \
                              Widget.cpp
                          
                          HEADERS += \
                              ColliderEdge.h \
                              DebugDrawer.h \
                              VertexBuffers.h \
                              Widget.h
                          
                          # Default rules for deployment.
                          qnx: target.path = /tmp/$${TARGET}/bin
                          else: unix:!android: target.path = /opt/$${TARGET}/bin
                          !isEmpty(target.path): INSTALLS += target
                          
                          RESOURCES += \
                              Levels.qrc \
                              Shaders.qrc \
                              Sounds.qrc \
                              Sprites.qrc
                          

                          I tried to place it at the end:

                          QT       += core gui openglwidgets
                          
                          INCLUDEPATH += "C:\Program Files\FMOD SoundSystem\FMOD Studio API Windows\api\core\inc"
                          LIBS += "C:\Program Files\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x64\fmod.dll"
                          
                          INCLUDEPATH += "E:\Libs\box2d-2.4.1-mingw-64-bit\include"
                          LIBS += -L"E:\Libs\box2d-2.4.1-mingw-64-bit\lib"
                          LIBS += -lbox2d
                          
                          win32: LIBS += -lopengl32
                          
                          greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
                          
                          CONFIG += c++11
                          
                          # You can make your code fail to compile if it uses deprecated APIs.
                          # In order to do so, uncomment the following line.
                          #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                          
                          SOURCES += \
                              ColliderEdge.cpp \
                              DebugDrawer.cpp \
                              VertexBuffers.cpp \
                              main.cpp \
                              Widget.cpp
                          
                          HEADERS += \
                              ColliderEdge.h \
                              DebugDrawer.h \
                              VertexBuffers.h \
                              Widget.h
                          
                          # Default rules for deployment.
                          qnx: target.path = /tmp/$${TARGET}/bin
                          else: unix:!android: target.path = /opt/$${TARGET}/bin
                          !isEmpty(target.path): INSTALLS += target
                          
                          RESOURCES += \
                              Levels.qrc \
                              Shaders.qrc \
                              Sounds.qrc \
                              Sprites.qrc
                          

                          I tried to place it at the beginning:

                          QT       += core gui openglwidgets
                          
                          win32: LIBS += -lopengl32
                          
                          INCLUDEPATH += "C:\Program Files\FMOD SoundSystem\FMOD Studio API Windows\api\core\inc"
                          LIBS += "C:\Program Files\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x64\fmod.dll"
                          
                          INCLUDEPATH += "E:\Libs\box2d-2.4.1-mingw-64-bit\include"
                          LIBS += -L"E:\Libs\box2d-2.4.1-mingw-64-bit\lib"
                          LIBS += -lbox2d
                          
                          greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
                          
                          CONFIG += c++11
                          
                          # You can make your code fail to compile if it uses deprecated APIs.
                          # In order to do so, uncomment the following line.
                          #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                          
                          SOURCES += \
                              ColliderEdge.cpp \
                              DebugDrawer.cpp \
                              VertexBuffers.cpp \
                              main.cpp \
                              Widget.cpp
                          
                          HEADERS += \
                              ColliderEdge.h \
                              DebugDrawer.h \
                              VertexBuffers.h \
                              Widget.h
                          
                          # Default rules for deployment.
                          qnx: target.path = /tmp/$${TARGET}/bin
                          else: unix:!android: target.path = /opt/$${TARGET}/bin
                          !isEmpty(target.path): INSTALLS += target
                          
                          RESOURCES += \
                              Levels.qrc \
                              Shaders.qrc \
                              Sounds.qrc \
                              Sprites.qrc
                          

                          But the result is the same. It compiles without errors for dynamic version of Qt (both for Debug and Release) and it does not work for static release only.

                          C 1 Reply Last reply 3 Sept 2022, 16:05
                          0
                          • 8 8Observer8
                            3 Sept 2022, 15:54

                            I tried to delete this line win32: LIBS += -lopengl32:

                            QT       += core gui openglwidgets
                            
                            INCLUDEPATH += "C:\Program Files\FMOD SoundSystem\FMOD Studio API Windows\api\core\inc"
                            LIBS += "C:\Program Files\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x64\fmod.dll"
                            
                            INCLUDEPATH += "E:\Libs\box2d-2.4.1-mingw-64-bit\include"
                            LIBS += -L"E:\Libs\box2d-2.4.1-mingw-64-bit\lib"
                            LIBS += -lbox2d
                            
                            greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
                            
                            CONFIG += c++11
                            
                            # You can make your code fail to compile if it uses deprecated APIs.
                            # In order to do so, uncomment the following line.
                            #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                            
                            SOURCES += \
                                ColliderEdge.cpp \
                                DebugDrawer.cpp \
                                VertexBuffers.cpp \
                                main.cpp \
                                Widget.cpp
                            
                            HEADERS += \
                                ColliderEdge.h \
                                DebugDrawer.h \
                                VertexBuffers.h \
                                Widget.h
                            
                            # Default rules for deployment.
                            qnx: target.path = /tmp/$${TARGET}/bin
                            else: unix:!android: target.path = /opt/$${TARGET}/bin
                            !isEmpty(target.path): INSTALLS += target
                            
                            RESOURCES += \
                                Levels.qrc \
                                Shaders.qrc \
                                Sounds.qrc \
                                Sprites.qrc
                            

                            I tried to place it at the end:

                            QT       += core gui openglwidgets
                            
                            INCLUDEPATH += "C:\Program Files\FMOD SoundSystem\FMOD Studio API Windows\api\core\inc"
                            LIBS += "C:\Program Files\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x64\fmod.dll"
                            
                            INCLUDEPATH += "E:\Libs\box2d-2.4.1-mingw-64-bit\include"
                            LIBS += -L"E:\Libs\box2d-2.4.1-mingw-64-bit\lib"
                            LIBS += -lbox2d
                            
                            win32: LIBS += -lopengl32
                            
                            greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
                            
                            CONFIG += c++11
                            
                            # You can make your code fail to compile if it uses deprecated APIs.
                            # In order to do so, uncomment the following line.
                            #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                            
                            SOURCES += \
                                ColliderEdge.cpp \
                                DebugDrawer.cpp \
                                VertexBuffers.cpp \
                                main.cpp \
                                Widget.cpp
                            
                            HEADERS += \
                                ColliderEdge.h \
                                DebugDrawer.h \
                                VertexBuffers.h \
                                Widget.h
                            
                            # Default rules for deployment.
                            qnx: target.path = /tmp/$${TARGET}/bin
                            else: unix:!android: target.path = /opt/$${TARGET}/bin
                            !isEmpty(target.path): INSTALLS += target
                            
                            RESOURCES += \
                                Levels.qrc \
                                Shaders.qrc \
                                Sounds.qrc \
                                Sprites.qrc
                            

                            I tried to place it at the beginning:

                            QT       += core gui openglwidgets
                            
                            win32: LIBS += -lopengl32
                            
                            INCLUDEPATH += "C:\Program Files\FMOD SoundSystem\FMOD Studio API Windows\api\core\inc"
                            LIBS += "C:\Program Files\FMOD SoundSystem\FMOD Studio API Windows\api\core\lib\x64\fmod.dll"
                            
                            INCLUDEPATH += "E:\Libs\box2d-2.4.1-mingw-64-bit\include"
                            LIBS += -L"E:\Libs\box2d-2.4.1-mingw-64-bit\lib"
                            LIBS += -lbox2d
                            
                            greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
                            
                            CONFIG += c++11
                            
                            # You can make your code fail to compile if it uses deprecated APIs.
                            # In order to do so, uncomment the following line.
                            #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                            
                            SOURCES += \
                                ColliderEdge.cpp \
                                DebugDrawer.cpp \
                                VertexBuffers.cpp \
                                main.cpp \
                                Widget.cpp
                            
                            HEADERS += \
                                ColliderEdge.h \
                                DebugDrawer.h \
                                VertexBuffers.h \
                                Widget.h
                            
                            # Default rules for deployment.
                            qnx: target.path = /tmp/$${TARGET}/bin
                            else: unix:!android: target.path = /opt/$${TARGET}/bin
                            !isEmpty(target.path): INSTALLS += target
                            
                            RESOURCES += \
                                Levels.qrc \
                                Shaders.qrc \
                                Sounds.qrc \
                                Sprites.qrc
                            

                            But the result is the same. It compiles without errors for dynamic version of Qt (both for Debug and Release) and it does not work for static release only.

                            C Online
                            C Online
                            Christian Ehrlicher
                            Lifetime Qt Champion
                            wrote on 3 Sept 2022, 16:05 last edited by
                            #13

                            @8Observer8 said in Qt6 OpenGL Static Release. Error: qopenglpaintengine.cpp:-1: error: undefined reference to &#x60;__imp_glMatrixMode':

                            I tried to delete this line win32: LIBS += -lopengl32:

                            Why? Did you read my post, the so post and what I suggested?

                            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                            Visit the Qt Academy at https://academy.qt.io/catalog

                            8 1 Reply Last reply 3 Sept 2022, 16:36
                            0
                            • C Christian Ehrlicher
                              3 Sept 2022, 16:05

                              @8Observer8 said in Qt6 OpenGL Static Release. Error: qopenglpaintengine.cpp:-1: error: undefined reference to &#x60;__imp_glMatrixMode':

                              I tried to delete this line win32: LIBS += -lopengl32:

                              Why? Did you read my post, the so post and what I suggested?

                              8 Offline
                              8 Offline
                              8Observer8
                              wrote on 3 Sept 2022, 16:36 last edited by
                              #14

                              @Christian-Ehrlicher said in Qt6 OpenGL Static Release. Error: qopenglpaintengine.cpp:-1: error: undefined reference to &#x60;__imp_glMatrixMode':

                              Why? Did you read my post, the so post and what I suggested?

                              I tried removing this line as an experiment to see if there would be more errors, but the number of errors remained the same. This is some kind of mystic. It's as if the linker is ignoring -lopengl32

                              1 Reply Last reply
                              0
                              • 8 8Observer8
                                3 Sept 2022, 08:00

                                Maybe should I include -opengl (or something like this) to config command before the static build?

                                configure -prefix "C:\Qt6.2.0_Static" -static -static-runtime -release -opensource -confirm-license -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -sql-odbc -sql-sqlite -nomake tools -nomake examples -nomake tests -skip qttools -skip qtquick3d -skip qt5compat -skip qtquicktimeline -skip qtwebengine -skip qtactiveqt -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtimageformats -skip qtlottie -skip qtnetworkauth -skip qtremoteobjects -skip qtvirtualkeyboard -skip qtserialbus -skip qtserialport -skip qtwebchannel -skip qtwebview -skip qtwayland -skip qtscxml -skip qtmqtt -skip qtopcua -skip qtsvg -skip qtdoc -skip qttranslations

                                8 Offline
                                8 Offline
                                8Observer8
                                wrote on 3 Sept 2022, 16:58 last edited by 8Observer8 9 Mar 2022, 17:01
                                #15

                                @8Observer8 said in Qt6 OpenGL Static Release. Error: qopenglpaintengine.cpp:-1: error: undefined reference to &#x60;__imp_glMatrixMode':

                                Maybe should I include -opengl (or something like this) to config command before the static build?

                                configure -prefix "C:\Qt6.2.0_Static" -static -static-runtime -release -opensource -confirm-license -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -sql-odbc -sql-sqlite -nomake tools -nomake examples -nomake tests -skip qttools -skip qtquick3d -skip qt5compat -skip qtquicktimeline -skip qtwebengine -skip qtactiveqt -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtimageformats -skip qtlottie -skip qtnetworkauth -skip qtremoteobjects -skip qtvirtualkeyboard -skip qtserialbus -skip qtserialport -skip qtwebchannel -skip qtwebview -skip qtwayland -skip qtscxml -skip qtmqtt -skip qtopcua -skip qtsvg -skip qtdoc -skip qttranslations

                                Here is -opengl

                                1 Reply Last reply
                                0
                                • 8 Offline
                                  8 Offline
                                  8Observer8
                                  wrote on 4 Sept 2022, 15:42 last edited by 8Observer8 9 Apr 2022, 15:48
                                  #16

                                  @Christian-Ehrlicher said in Qt6 OpenGL Static Release. Error: qopenglpaintengine.cpp:-1: error: undefined reference to &#x60;__imp_glMatrixMode':

                                  Why? Did you read my post, the so post and what I suggested?

                                  Yes, I did. For example, I tried this: In the linker, at Windows, MinGW: -lglew32 -lglfw3 -lopengl32 -lglu32 -lgdi32 But I do not use GLFW and GLEW. I tried these keys: lglu32 -lgdi32. I made a simple example in OpenGL. It compiles without errors for dynamic version of Qt 6.2.0 (both: for Debug and for Release builds) but it does not compile for static release only. Errors:

                                  qopenglpaintengine.cpp:-1: error: undefined reference to `__imp_glMatrixMode'
                                  qopenglpaintengine.cpp:-1: error: undefined reference to `__imp_glLoadIdentity'
                                  qopenglpaintengine.cpp:-1: error: undefined reference to `__imp_glOrtho'
                                  qopenglpaintengine.cpp:-1: error: undefined reference to `__imp_glLoadMatrixf'
                                  

                                  pro

                                  QT       += core gui openglwidgets
                                  win32: LIBS += -lopengl32 -lglu32 -lgdi32
                                  

                                  main.cpp

                                  
                                  #include <QtWidgets/QApplication>
                                  #include <QtOpenGLWidgets/QOpenGLWidget>
                                  #include <QtGui/QOpenGLFunctions>
                                  
                                  class Widget : public QOpenGLWidget, QOpenGLFunctions
                                  {
                                  private:
                                      void initializeGL() override
                                      {
                                          initializeOpenGLFunctions();
                                          glClearColor(0.3f, 0.3f, 0.3f, 1.f);
                                      }
                                  
                                      void paintGL() override
                                      {
                                          glClear(GL_COLOR_BUFFER_BIT);
                                      }
                                  };
                                  
                                  int main(int argc, char *argv[])
                                  {
                                      QApplication a(argc, argv);
                                      Widget w;
                                      w.show();
                                      return a.exec();
                                  }
                                  
                                  1 Reply Last reply
                                  0
                                  • 8 Offline
                                    8 Offline
                                    8Observer8
                                    wrote on 4 Sept 2022, 15:44 last edited by 8Observer8 9 Apr 2022, 15:44
                                    #17

                                    What else should I try?

                                    1 Reply Last reply
                                    0
                                    • 8 Offline
                                      8 Offline
                                      8Observer8
                                      wrote on 4 Sept 2022, 15:47 last edited by 8Observer8 9 Apr 2022, 15:47
                                      #18

                                      I tried putting -lopengl32 at the end of the line: win32: LIBS += -lglu32 -lgdi32 -lopengl32

                                      But:

                                      a640349d-cf98-4f39-af5b-cff441c62b82-image.png

                                      1 Reply Last reply
                                      0
                                      • 8 Offline
                                        8 Offline
                                        8Observer8
                                        wrote on 4 Sept 2022, 20:55 last edited by 8Observer8 9 Apr 2022, 20:56
                                        #19

                                        I tried to create a question on StackOverflow: Failed to build OpenGL project with static Qt 6.2.0 but my question was closed as duplicate:

                                        This question already has answers here:
                                        What is an undefined reference/unresolved external symbol error and how do I fix it? (38 answers)

                                        If anyone encounters this problem and solves it, then please write here how you solved this problem. I did everything I could.

                                        1 Reply Last reply
                                        0
                                        • F Offline
                                          F Offline
                                          fxr65
                                          wrote on 5 Sept 2022, 09:33 last edited by fxr65 9 May 2022, 09:34
                                          #20

                                          Probably you have to add the path to the libraries like this (in case the libs are in your project working dir):
                                          LIBS += -L$$PWD -l<blah>
                                          At least this helped me, as I had to add a lib to my project.

                                          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