我使用的是 Visual Studio 2019 社區 x64,Qt 版本 5.15.2。我在專案 -> 屬性 -> Qt 專案設定 -> Qt 模塊中安裝并選擇了“圖表”模塊
我的代碼:
#include <QCandlestickSet>
struct Bar
{
double open, close, high, low;
qint64 timestamp;
Bar() : open(0.0), close(0.0), high(0.0), low(0.0), timestamp(0)
{
}
QCandlestickSet * toCandle(void)
{
return new QCandlestickSet(this->open, this->high, this->low, this->close, this->timestamp);
}
};
我收到錯誤:
嚴重性代碼說明專案檔案行抑制狀態錯誤(活動)E0020 識別符號“QCandlestickSet”未定義 ProjectName ..\Bar.h 27
任何幫助,將不勝感激。
先感謝您。
uj5u.com熱心網友回復:
正如 GM 的評論中提到的,與 QtChart 相關的所有內容都保存在名為 QtCharts 的命名空間中。
執行以下任一操作將解決此問題:
using QtCharts::QCandlestickSet;
或者
using namespace QtCharts;
或者
QtCharts::QCandlestickSet * toCandle(void)
{
return new QtCharts::QCandlestickSet(this->open, this->high, this->low, this->close, this->timestamp);
}
雖然在 QCandlestickSet 相關的頁面中沒有提到命名空間,但在QtCharts 頁面上提到了
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/366872.html
上一篇:npm錯誤!吉普錯誤!在安裝了VisualStudio2022Enterprise的Windows11中安裝節點sass時
