如何修复"QtCharts"库文件找不到/无法包含<QtCharts>?
How to fix "QtCharts" library file not found/can't include <QtCharts>?
我是Qt GUI/Widget应用程序的新手,我正在尝试制作一个简单的条形图。我试图复制QT在他们的网站上提供的完全相同的代码,[链接]:https://doc-snapshots.qt.io/qt5-5.11/qtcharts-barchart-example.html#creating-bar-charts。但是,我不断收到很多错误消息,说找不到"QtCharts"文件和"QBarSet"QLegend",基本上每个包含的库都没有找到。
我在QT网站上看到了一些故障排除页面,它说我必须在我的.qml文件中添加一些导入语句。但是我似乎找不到.qml文件的位置?[链接]: https://doc.qt.io/qt-5/qtcharts-index.html
我的代码看起来像这样:
//main.cpp
----------
[link]: https://doc-snapshots.qt.io/qt5-5.11/qtcharts-barchart-main-cpp.html
//.pro file
------------
QT += core gui charts
//I only add "charts" in the above line from the original .pro file
//everything else is the exact same .pro file as in the original.
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = testing_file
TEMPLATE = app
DEFINES += QT_DEPRECATED_WARNINGS
SOURCES +=
main.cpp
mainwindow.cpp
HEADERS +=
mainwindow.h
FORMS +=
mainwindow.ui
你如何修复/使代码工作?我真的不知道如何解决错误消息。谢谢!
我刚刚意识到我没有安装QT Charts的组件/子模块,正如eyllanesc提到的。我不得不重新安装QT并启用QT图表组件。您可以使用QT维护工具添加它,但我没有它,所以我只是重新安装它,因为我仍然有安装程序。
参考:如何在Qt Creator 4.2.0(社区(中包含QtCharts库
相关文章:
- 如何导出包含具有"std::unique_ptr"值的"std::map"属性的
- 从包含m行的文件中提取n行,必要时(惰性地)重复该文件
- 编译包含字符串的代码时遇到问题
- c++库的公共头文件中应该包含什么
- 将包含C样式数组的对象初始化为成员变量(C++)
- 是否需要删除包含对象的"pair"?
- 函数何时会在c++中包含stack_Unwind_Resume调用
- 如何将包含epoch时间的十六进制字符串转换为time_t
- 使用mongocxx驱动程序时包含头文件问题
- 如何在h文件中包含.o对象文件
- 在混合代码库中将C转换为C++时出现许多包含错误
- VS2017,C++包含目录与附加包含目录,子文件夹包含失败-但为什么
- cmath抛出错误C2062、C2059、C2143和C2447.cmath包含在矢量文件中
- 为什么您需要C++头文件的包含保护
- 无法在UE4中包含BP类到CPP类
- g++ 说函数不存在,即使包含正确的标头
- 在C++代码中包含opencv时,使用ctypes创建.so文件
- Visual C++GC接口如何启用它以及要包含哪个库
- 如何修复"QtCharts"库文件找不到/无法包含<QtCharts>?
- 不能包含<QtCharts/QLineSeries>