?-6ren"> ?- 这个问题在这里已经有了答案: How to include the QtCharts library in Qt Creator 4.2.0 (Community) (1 个回答) 关闭 3 年前。-6ren">
gpt4 book ai didi

c++ - 如何修复 "QtCharts"库文件未找到/无法包含

转载 作者:行者123 更新时间:2023-12-05 05:10:33 25 4
gpt4 key购买 nike

<分区>

我是 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

您如何修复/使代码工作?我真的不知道如何修复错误消息。谢谢!

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com