项目场景: ‘QChart’ file not found error unknown type nam 'QT_CHARTS_USE_NAMESP. 使用QT图表是包含两个头文件,发现报错。 解决方案: 第一种解决方法:在.pro文件中加上 QT += core gui charts 第二种解决方法: 直接使用以下头文件包含方法 #include <QtCharts/QChart> #include <QtCharts/QChartView>