QCustomPlot Discussion and Comments

Compile QCP2 with OpenGLReturn to overview

Hello,

I am trying to compile QCP2 with OpenGL usage using following pro file (just one line added to default one)

#
#  Project to compile QCustomPlot as shared library (.so/.dll) from the amalgamated sources
#

QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

DEFINES += QCUSTOMPLOT_COMPILE_LIBRARY
DEFINES += QCUSTOMPLOT_USE_OPENGL
TEMPLATE = lib
CONFIG += debug_and_release build_all
static {
  CONFIG += static
} else {
  CONFIG += shared
}

VERSION = 2.0.1

TARGET = qcustomplot
CONFIG(debug, debug|release) {
  TARGET = $$join(TARGET,,,d) # if compiling in debug mode, append a "d" to the library name
  QMAKE_TARGET_PRODUCT = "QCustomPlot (debug mode)"
  QMAKE_TARGET_DESCRIPTION = "Plotting library for Qt (debug mode)"
} else {
  QMAKE_TARGET_PRODUCT = "QCustomPlot"
  QMAKE_TARGET_DESCRIPTION = "Plotting library for Qt"
}
QMAKE_TARGET_COMPANY = "www.qcustomplot.com"
QMAKE_TARGET_COPYRIGHT = "Copyright (C) by Emanuel Eichhammer"

SOURCES += ../../qcustomplot.cpp
HEADERS += ../../qcustomplot.h


But I get compilation error:
release/qcustomplot.o:qcustomplot.cpp:(.text+0x2804): undefined reference to `__imp_glClearColor'
release/qcustomplot.o:qcustomplot.cpp:(.text+0x280f): undefined reference to `__imp_glClear'
collect2.exe: error: ld returned 1 exit status
mingw32-make[1]: *** [Makefile.Release:66: release/qcustomplot2.dll] Error 1
mingw32-make[1]: Leaving directory 'D:/Programming/Qt/qcustomplot/qcustomplot-sharedlib/build-sharedlib-compilation-Desktop_Qt_5_12_3_MinGW_64_bit-Debug'
mingw32-make: *** [Makefile:56: release-all] Error 2
mingw32-make: *** Waiting for unfinished jobs....
debug/qcustomplot.o: In function `QCPPaintBufferGlFbo::clear(QColor const&)':
D:\Programming\Qt\qcustomplot\qcustomplot-sharedlib\build-sharedlib-compilation-Desktop_Qt_5_12_3_MinGW_64_bit-Debug/../../qcustomplot.cpp:909: undefined reference to `__imp_glClearColor'
D:\Programming\Qt\qcustomplot\qcustomplot-sharedlib\build-sharedlib-compilation-Desktop_Qt_5_12_3_MinGW_64_bit-Debug/../../qcustomplot.cpp:910: undefined reference to `__imp_glClear'
collect2.exe: error: ld returned 1 exit status
mingw32-make[1]: *** [Makefile.Debug:66: debug/qcustomplotd2.dll] Error 1
mingw32-make: *** [Makefile:42: debug-all] Error 2
mingw32-make[1]: Leaving directory 'D:/Programming/Qt/qcustomplot/qcustomplot-sharedlib/build-sharedlib-compilation-Desktop_Qt_5_12_3_MinGW_64_bit-Debug'
22:52:12: The process "D:\Qt\Tools\mingw730_64\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project sharedlib-compilation (kit: Desktop Qt 5.12.3 MinGW 64-bit)
When executing step "Make"

Can someone provide me with the way to resolve it or just guide how to compile OpenGL library?
Thanks!

I had the same problem, did you solve it?