Important: Please read the Qt Code of Conduct -

Unable to compile when using QCustomPlot

  • Hi,
    I want to use QCustomPlot in order to plot some data in a mainwindow. In order to do that, I follow the basic tutorial found here. Every thing seems to work, until I decide to include any custom header in the header of the module that has the promoted widget. Let's say that this module is called mainWindow and I want to include the custom file "myDataClasses.h" in the header of mainWindow:

    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H
    #include <QMainWindow>
    #include "myDataClasses.h" // custom header that causes problem
    namespace Ui { class MainWindow; }

    If I try to compile the program, no matter what custom header I include in mainwindow.h, I get a bunch of errors that I don't understand regarding the qgenericmatrix.h module as you can see in the image below.


    Can someone give me a clue of what is going on? It used to work before... I use Qt Creator 4.15.0 based on Qt 5.15.2 MSVC2019.

    Thanks in advance for your help!

  • Lifetime Qt Champion

    @JPolo said in Unable to compile when using QCustomPlot:

    I use Qt Creator 4.15.0 based on Qt 5.15.2 MSVC2019

    That is not necesserilly Qt version you're using (this is the Qt version used to build QtCreator).
    What Qt version did you install?

    What is the first error message?
    Did you do what the tutorial suggests: "To use the shared library in your application, set the define QCUSTOMPLOT_USE_LIBRARY before including the QCustomPlot header."?