QChart undefined reference to _imp__ZN8QtCharts



  • Hi,
    in mainwindow.h is:
    #include <QtSerialPort/QSerialPort>
    #include <QtCharts/QtCharts>
    private:
    Ui::MainWindow *ui;
    QSerialPort *serial;
    QChart *tempChart;

    and in mainwindow.cpp is:
    serial = new QSerialPort(this);
    tempChart = new QChart();

    Both new object *serial and *tempChart is brown highlighted and focused.
    Object serial works normally and object tempChart has error "undefined reference to `_imp___ZN8QtCharts6QChartC1EP13QGraphicsItem6QFlagsIN2Qt10WindowTypeEE'
    Where to look for a mistake


  • Qt Champions 2016

    @Milori said in QChart undefined reference to _imp__ZN8QtCharts:

    QtCharts

    Hi
    Do you have
    QT += charts
    in the .pro file?



  • No :), thanks.
    One Small question:
    is any link to pdf where is decribed this and others requires to correctly building QT projects?


  • Qt Champions 2016

    @Milori
    For all classes, its listed in docs.
    http://doc.qt.io/qt-5/qtcharts-index.html
    says so down the page.

    Other example
    http://doc.qt.io/qt-5/qserialport.html
    alt text



  • I apologize but i don't find asked pdf file on links.
    Where to study, for example, how different between import QT += serialport and QT +=core gui serialport is?


  • Moderators

    @Milori Why do you need a PDF? The link posted by @mrjj points to official Qt documentation - there are no PDFs.
    "QT += serialport" - only adds support for serialport to your app (makes the serial port Qt classes available)
    "QT +=core gui serialport" - same as above but adds core and gui modules as well
    You only need to add modules you need, as @mrjj said you find which modules a class belongs to in its documentation.
    You should read this http://doc.qt.io/qt-5/qtmodules.html


Log in to reply