error in compile qt charts in qt 5.15.0
-
I downloaded qt-everywhere-src-5.15.0, and compiled successfully. but it doesn't include 'qtchats' by default.
when I try to compile qtcharts, some error occur.
I use x86 Native Tools Command Prompt for VS 2019, and commands are below:mkdir build_chart
cd build_chart
c:\Qt\Qt-5.15.0\bin\qmake.exe d:\Qt\qt-everywhere-src-5.15.0\qtcharts
nmake
errors are:D:\Qt\qt-everywhere-src-5.15.0\qtcharts\include\QtCharts\5.15.0\QtCharts\private../../../../../src/charts/xychart/qxyseries_p.h(85): error C2440: 'static_cast': cannot convert from 'QtCharts::QAbstractSeries *' to 'QtCharts::QXYSeries *'
D:\Qt\qt-everywhere-src-5.15.0\qtcharts\include\QtCharts\5.15.0\QtCharts\private../../../../../src/charts/xychart/qxyseries_p.h(85): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
D:\Qt\qt-everywhere-src-5.15.0\qtcharts\include\QtCharts\5.15.0\QtCharts\private../../../../../src/charts/xychart/qxyseries_p.h(85): error C2440: 'static_cast': cannot convert from 'QtCharts::QAbstractSeries const ' to 'const QtCharts::QXYSeries '
D:\Qt\qt-everywhere-src-5.15.0\qtcharts\include\QtCharts\5.15.0\QtCharts\private../../../../../src/charts/xychart/qxyseries_p.h(85): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
D:\Qt\qt-everywhere-src-5.15.0\qtcharts\include\QtCharts\5.15.0\QtCharts\private../../../../../src/charts/linechart/qlineseries_p.h(51): error C2061: syntax error: identifier 'QLineSeries'
D:\Qt\qt-everywhere-src-5.15.0\qtcharts\include\QtCharts\5.15.0\QtCharts\private../../../../../src/charts/linechart/qlineseries_p.h(56): error C2143: syntax error: missing ';' before ''
D:\Qt\qt-everywhere-src-5.15.0\qtcharts\include\QtCharts\5.15.0\QtCharts\private../../../../../src/charts/linechart/qlineseries_p.h(56): error C7524: 'inline' specifier cannot appear on a block-scope declaration or non-static data member
D:\Qt\qt-everywhere-src-5.15.0\qtcharts\include\QtCharts\5.15.0\QtCharts\private../../../../../src/charts/linechart/qlineseries_p.h(56): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
D:\Qt\qt-everywhere-src-5.15.0\qtcharts\include\QtCharts\5.15.0\QtCharts\private../../../../../src/charts/linechart/qlineseries_p.h(56): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
d:\Qt\bchart\src\charts.moc\debug../../../../../qt-everywhere-src-5.15.0/qtcharts/src/charts/splinechart/qsplineseries_p.h(52): error C2061: syntax error: identifier 'QSplineSeries'
d:\Qt\bchart\src\charts.moc\debug../../../../../qt-everywhere-src-5.15.0/qtcharts/src/charts/splinechart/qsplineseries_p.h(60): error C2143: syntax error: missing ';' before ''
d:\Qt\bchart\src\charts.moc\debug../../../../../qt-everywhere-src-5.15.0/qtcharts/src/charts/splinechart/qsplineseries_p.h(60): error C7524: 'inline' specifier cannot appear on a block-scope declaration or non-static data member
d:\Qt\bchart\src\charts.moc\debug../../../../../qt-everywhere-src-5.15.0/qtcharts/src/charts/splinechart/qsplineseries_p.h(60): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\Qt\bchart\src\charts.moc\debug../../../../../qt-everywhere-src-5.15.0/qtcharts/src/charts/splinechart/qsplineseries_p.h(60): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
Generating Code...
Compiling...
moc_xychart_p.cpp
moc_qxyseries_p.cpp
d:\Qt\bchart\src\charts.moc\debug../../../../../qt-everywhere-src-5.15.0/qtcharts/src/charts/xychart/qxyseries_p.h(85): error C2440: 'static_cast': cannot convert from 'QtCharts::QAbstractSeries *' to 'QtCharts::QXYSeries *'
d:\Qt\bchart\src\charts.moc\debug../../../../../qt-everywhere-src-5.15.0/qtcharts/src/charts/xychart/qxyseries_p.h(85): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
d:\Qt\bchart\src\charts.moc\debug../../../../../qt-everywhere-src-5.15.0/qtcharts/src/charts/xychart/qxyseries_p.h(85): error C2440: 'static_cast': cannot convert from 'QtCharts::QAbstractSeries *const ' to 'const QtCharts::QXYSeries *'
d:\Qt\bchart\src\charts.moc\debug../../../../../qt-everywhere-src-5.15.0/qtcharts/src/charts/xychart/qxyseries_p.h(85): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
moc_qxymodelmapper_p.cpp
moc_glxyseriesdata_p.cpp
moc_boxplotchartitem_p.cpp
moc_qboxplotseries_p.cpp
moc_boxwhiskers_p.cpp
moc_qboxset_p.cpp
moc_qboxplotmodelmapper_p.cpp
moc_candlestick_p.cpp
moc_candlestickchartitem_p.cpp
moc_qcandlestickseries_p.cpp
d:\Qt\bchart\src\charts.moc\debug../../../../../qt-everywhere-src-5.15.0/qtcharts/src/charts/candlestickchart/qcandlestickseries_p.h(109): error C2440: 'static_cast': cannot convert from 'QtCharts::QAbstractSeries *' to 'QtCharts::QCandlestickSeries *'
d:\Qt\bchart\src\charts.moc\debug../../../../../qt-everywhere-src-5.15.0/qtcharts/src/charts/candlestickchart/qcandlestickseries_p.h(109): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
d:\Qt\bchart\src\charts.moc\debug../../../../../qt-everywhere-src-5.15.0/qtcharts/src/charts/candlestickchart/qcandlestickseries_p.h(109): error C2440: 'static_cast': cannot convert from 'QtCharts::QAbstractSeries *const ' to 'const QtCharts::QCandlestickSeries *'
d:\Qt\bchart\src\charts.moc\debug../../../../../qt-everywhere-src-5.15.0/qtcharts/src/charts/candlestickchart/qcandlestickseries_p.h(109): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
moc_qcandlestickset_p.cpp
moc_qcandlestickmodelmapper_p.cpp
Generating Code...
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\bin\HostX86\x86\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.26.28801\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.I am confused about the error as 'Q_DECLARE_PUBLIC' is defined in qglobal.h and many submodules use this MACRO, why only qtchart has error in calling this MACRO.
How to fix this error, can anyone help, thanks.