QChart: invalid use of incomplete type 'class QChartView'
-
Hi,
I did all recommendations I have found.
I installed qchart module withsudo apt install libqt5charts5-dev.
I added
QT += charts
to my project.
The header file qchartview.h is found without problems.
Still get compiler error:
invalid use of incomplete type 'class QChartView'
What can be wrong?Just a simplified C++ code for understanding
#include <QChartView>
QChartView m_chartView = new QChartView(centralTabWidget); -
Hi,
I did all recommendations I have found.
I installed qchart module withsudo apt install libqt5charts5-dev.
I added
QT += charts
to my project.
The header file qchartview.h is found without problems.
Still get compiler error:
invalid use of incomplete type 'class QChartView'
What can be wrong?Just a simplified C++ code for understanding
#include <QChartView>
QChartView m_chartView = new QChartView(centralTabWidget);@Alexander-Maltsev Did you try a complete rebuild: delete build folder, run qmake and build?
-
Yes I did. Exactly the same error
-
Yes I did. Exactly the same error
@Alexander-Maltsev Is it possible that you're using QChartView somewhere else where you do not include the header file?
-
I include <QChartView> directly in mainwindow.cpp.
The code line QChartView m_chartView = new QChartView(centralTabWidget); in mainwindow.cpp causes the compiler error I mentioned abovePardon, the line is
QChartView *m_chartView = new QChartView(centralTabWidget); -
I include <QChartView> directly in mainwindow.cpp.
The code line QChartView m_chartView = new QChartView(centralTabWidget); in mainwindow.cpp causes the compiler error I mentioned abovePardon, the line is
QChartView *m_chartView = new QChartView(centralTabWidget);@Alexander-Maltsev said in QChart: invalid use of incomplete type 'class QChartView':
The code line QChartView m_chartView = new QChartView(centralTabWidget);
Pardon, the line is
QChartView *m_chartView = new QChartView(centralTabWidget)
Please use copy & paste when quoting from your code, we spend too much time chasing down issues when people just "type" what they (think they) have in code only to later discover they actually have something else like here!
Do you have a
.h
file declaring your class? Assuming so, show that and what you do about declaringQChartView
there prior to your use ofQChartView
anywhere inside it. Read again what @jsulm has written "Is it possible that you're using QChartView somewhere else". The error message names a file and a line number: make 100% certain that is on yourQChartView *m_chartView = new QChartView(centralTabWidget);
statement and not somewhere else? -
This is the solution
QtCharts::QChartView *m_chartView = new QtCharts::QChartView(centralTabWidget);
Sorry for inconveneience
-
@Alexander-Maltsev said in QChart: invalid use of incomplete type 'class QChartView':
The code line QChartView m_chartView = new QChartView(centralTabWidget);
Pardon, the line is
QChartView *m_chartView = new QChartView(centralTabWidget)
Please use copy & paste when quoting from your code, we spend too much time chasing down issues when people just "type" what they (think they) have in code only to later discover they actually have something else like here!
Do you have a
.h
file declaring your class? Assuming so, show that and what you do about declaringQChartView
there prior to your use ofQChartView
anywhere inside it. Read again what @jsulm has written "Is it possible that you're using QChartView somewhere else". The error message names a file and a line number: make 100% certain that is on yourQChartView *m_chartView = new QChartView(centralTabWidget);
statement and not somewhere else?@JonB If I write the error message is caused exactly by the line I show then it is so. I apologized for my previous mistake. I beg your pardon for spending too much valuable time and thank you very much for your assistance
-
@JonB If I write the error message is caused exactly by the line I show then it is so. I apologized for my previous mistake. I beg your pardon for spending too much valuable time and thank you very much for your assistance
@Alexander-Maltsev
I was just trying to help, getting the facts straight. I am glad you have it working now.