【问题标题】:Error : 'bool QTabWidget::hasHeightForWidth() const' marked 'override', but does not override bool hasHeightForWidth() const Q_DECL_OVERRIDE;错误:“bool QTabWidget::hasHeightForWidth() const”标记为“覆盖”,但不覆盖 bool hasHeightForWidth() const Q_DECL_OVERRIDE;
【发布时间】:2018-05-20 00:10:43
【问题描述】:

我正在尝试在 REDHAT 6.5 中构建我的 qt 应用程序,但收到此错误。

错误代码:

error: bool QTabWidget::hasHeightForWidth() const marked 

'覆盖',但不覆盖 bool hasHeightForWidth() const Q_DECL_OVERRIDE;

我正在使用 Qt 5

g++ 6.3 版

在我的 .pro 文件中,我已经提到使用 c++11 版本

QMAKE_CXXFLAGS += -std=c++11

我也试过设置

CONFIG += cpp11

但它仍然抛出相同的错误。我还缺少什么?

【问题讨论】:

  • 显示包含 hasHeightForWidth() 声明的头文件

标签: c++ qt c++11


【解决方案1】:

我遇到了同样的错误。原来是由于一个流氓 Qt4 风格的包含(在我的例子中,QtGui/QTabWidget)。确保您没有任何无意中指向 Qt4 标头的包含...

【讨论】:

    【解决方案2】:

    当我包含这些文件时,它工作正常。

    #include <QtCore>
    #include <QtGui>
    #include <QDialog> //if you are using dialog boxes in this header or cpp file.
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-08-29
      • 1970-01-01
      • 1970-01-01
      • 2021-07-29
      • 2023-01-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多