[Visual Studio] Error C2653, use C++ language, cooperate with Qt to develop serial communication interface

Knowledge is not alone, it must be systematic. More my personal summary and related experience can be found in this column: Visual Studio .

This bug was encountered when I was working on this project: [Visual Studio] Qt's real-time drawing curve function, using C++ language, cooperates with Qt to develop serial communication interface .

Article directory

question

Using C++ language and coordinating with Qt to develop the serial port communication interface, when adding Widget as the display box of QCharts, the error code C2653 is reported.

Copy the error message so that others can retrieve my article when searching. The error message is as follows:

Severity Code Description Project File Line Suppressed Display Status
Error C2653 "QtCharts": is not a class or namespace name (compile source file GUI.cpp) GUI C:\Users\jicha\source\repos\GUI\x64\Debug\uic\ ui_GUI.h 35

The screenshot of the error is as follows:

insert image description here

solution

The tutorials given on the Internet are correct, but they don't quite fit the architecture of my project. So QtCharts::QChartView, QChartViewjust change to .

A picture is better than the preface, and the solution should follow the picture below.

insert image description here

Then the picture below is a screenshot of the successful operation. hope this helps.

insert image description here

Ref.

  1. The use of QtChart of QT in VS
  2. Using QtChart in QT
  3. Qt GUI development (1) - simple use of Qt Chart

Guess you like

Origin blog.csdn.net/weixin_36815313/article/details/131346283