Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Opengl undefined references with qchartview
Qt 6.12 LTS is out! See what's new in the release blog

Opengl undefined references with qchartview

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 672 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.
  • B Offline
    B Offline
    Budeykin
    wrote on last edited by
    #1

    I need to use static version of Qt in Windows, so i've built static version with next configure options:

    configure -static -debug-and-release -platform win32-g++ -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -opensource -confirm-license -make libs -make tools -nomake examples -nomake tests -skip qtwebengine -skip qtpdf -skip qtquick3dphysics -skip qtconnectivity -skip qtwebchannel -skip qtwebview -skip qtnetworkauth -skip qtwayland -Wno-dev -prefix F:\\Qt\\6.5.2\\mingw_64_static
    
    

    I link it to the Qt Creator and it works fine without errors, but when i have ChartView in my project it doesn't link with this errors:

    :-1: error: F:\Qt\6.5.2\mingw_64_static\lib\libQt6OpenGL.a(qopenglpaintengine.cpp.obj):qopenglpaintengine.cpp:(.text$_ZN21QOpenGL2PaintEngineEx19beginNativePaintingEv+0x18e): undefined reference to `__imp_glMatrixMode'
    :-1: error: F:\Qt\6.5.2\mingw_64_static\lib\libQt6OpenGL.a(qopenglpaintengine.cpp.obj):qopenglpaintengine.cpp:(.text$_ZN21QOpenGL2PaintEngineEx19beginNativePaintingEv+0x199): undefined reference to `__imp_glLoadIdentity'
    :-1: error: F:\Qt\6.5.2\mingw_64_static\lib\libQt6OpenGL.a(qopenglpaintengine.cpp.obj):qopenglpaintengine.cpp:(.text$_ZN21QOpenGL2PaintEngineEx19beginNativePaintingEv+0x1d6): undefined reference to `__imp_glOrtho'
    :-1: error: F:\Qt\6.5.2\mingw_64_static\lib\libQt6OpenGL.a(qopenglpaintengine.cpp.obj):qopenglpaintengine.cpp:(.text$_ZN21QOpenGL2PaintEngineEx19beginNativePaintingEv+0x1e6): undefined reference to `__imp_glLoadMatrixf'
    

    Errors only occur if i use QChartView in my projects:

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    
    #include <QChart>
    #include <QChartView>
    
    MainWindow::MainWindow( QWidget* parent )
    	: QMainWindow( parent )
    	, ui( new Ui::MainWindow )
    {
    	QChart* chart = nullptr;
    	QChartView* chartView = new QChartView; // this string causes errors
    	ui->setupUi( this );
    }
    
    MainWindow::~MainWindow()
    {
    	delete ui;
    }
    

    I also have QT += charts in my .pro file

    What else i need to do to link my project statically?

    Christian EhrlicherC 1 Reply Last reply
    0
    • B Budeykin

      I need to use static version of Qt in Windows, so i've built static version with next configure options:

      configure -static -debug-and-release -platform win32-g++ -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -opensource -confirm-license -make libs -make tools -nomake examples -nomake tests -skip qtwebengine -skip qtpdf -skip qtquick3dphysics -skip qtconnectivity -skip qtwebchannel -skip qtwebview -skip qtnetworkauth -skip qtwayland -Wno-dev -prefix F:\\Qt\\6.5.2\\mingw_64_static
      
      

      I link it to the Qt Creator and it works fine without errors, but when i have ChartView in my project it doesn't link with this errors:

      :-1: error: F:\Qt\6.5.2\mingw_64_static\lib\libQt6OpenGL.a(qopenglpaintengine.cpp.obj):qopenglpaintengine.cpp:(.text$_ZN21QOpenGL2PaintEngineEx19beginNativePaintingEv+0x18e): undefined reference to `__imp_glMatrixMode'
      :-1: error: F:\Qt\6.5.2\mingw_64_static\lib\libQt6OpenGL.a(qopenglpaintengine.cpp.obj):qopenglpaintengine.cpp:(.text$_ZN21QOpenGL2PaintEngineEx19beginNativePaintingEv+0x199): undefined reference to `__imp_glLoadIdentity'
      :-1: error: F:\Qt\6.5.2\mingw_64_static\lib\libQt6OpenGL.a(qopenglpaintengine.cpp.obj):qopenglpaintengine.cpp:(.text$_ZN21QOpenGL2PaintEngineEx19beginNativePaintingEv+0x1d6): undefined reference to `__imp_glOrtho'
      :-1: error: F:\Qt\6.5.2\mingw_64_static\lib\libQt6OpenGL.a(qopenglpaintengine.cpp.obj):qopenglpaintengine.cpp:(.text$_ZN21QOpenGL2PaintEngineEx19beginNativePaintingEv+0x1e6): undefined reference to `__imp_glLoadMatrixf'
      

      Errors only occur if i use QChartView in my projects:

      #include "mainwindow.h"
      #include "ui_mainwindow.h"
      
      #include <QChart>
      #include <QChartView>
      
      MainWindow::MainWindow( QWidget* parent )
      	: QMainWindow( parent )
      	, ui( new Ui::MainWindow )
      {
      	QChart* chart = nullptr;
      	QChartView* chartView = new QChartView; // this string causes errors
      	ui->setupUi( this );
      }
      
      MainWindow::~MainWindow()
      {
      	delete ui;
      }
      

      I also have QT += charts in my .pro file

      What else i need to do to link my project statically?

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You need to link against the opengl library. see e.g. here: https://forum.qt.io/topic/84385/opengl32-lib-no-such-file-or-directory

      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
      1

      • Login

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