Opengl undefined references with qchartview
Unsolved
General and Desktop
-
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?
-
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