我对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
你如何修复/使代码正常工作?我真的不知道如何修复错误信息。谢谢!