【问题标题】:error use of undeclared identifier 'mainwindow' semantic issue in QtCreator在 QtCreator 中错误使用未声明的标识符“主窗口”语义问题
【发布时间】:2021-05-04 20:18:51
【问题描述】:

我刚刚创建了新的 Qt Widgets 应用程序。我打开 mainwindow.cpp,就像我在编辑器上时 ​​mainwindow.cpp 没有看到“mainwindow.h”一样。但编译器工作正常。我该如何解决这个语义问题?

我在 .pro 文件中添加了“QT += widgets”。它不起作用。

这些实际上是默认文件。

--mainwindow.h--

--mainwindow.cpp--

【问题讨论】:

  • 您将鼠标悬停在 QTcreator 上时显示什么消息?
  • 错误:使用未声明的标识符“MainWindow”

标签: c++ qt qt5 qt-creator


【解决方案1】:

我通过取消选中 Help/Plugins/C++/ClangCodeModel 并重新启动 QtCreator 来修复此错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-05-28
    • 1970-01-01
    • 2015-09-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多