error "Qt requires C++11 support"

Qt编译报错:

…/…/…/include/QtCore/…/…/src/corelib/global/qglobal.h:1172:1:
warning: identifier ‘nullptr’ is a keyword in C++11 [-Wc++0x-compat]
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName,
bool *ok=nullptr) Q_DECL_NOEXCEPT; ^ In file included from
…/…/…/include/QtCore/qbasicatomic.h:1:0,
from …/…/…/include/QtCore/…/…/src/corelib/thread/qatomic.h:46,
from …/…/…/include/QtCore/qatomic.h:1,
from …/…/…/include/QtCore/…/…/src/corelib/global/qglobal.h:1210,
from …/…/…/include/QtCore/qglobal.h:1,
from …/…/…/include/QtGui/…/…/src/gui/kernel/qtguiglobal.h:43,
from …/…/…/include/QtGui/qtguiglobal.h:1,
from …/…/…/include/QtWidgets/…/…/src/widgets/kernel/qtwidgetsglobal.h:43,
from …/…/…/include/QtWidgets/qtwidgetsglobal.h:1,
from …/…/…/include/QtWidgets/…/…/src/widgets/kernel/qapplication.h:43,
from …/…/…/include/QtWidgets/qapplication.h:1,
from …/…/…/include/QtWidgets/QApplication:1,
from main.cpp:51: …/…/…/include/QtCore/…/…/src/corelib/thread/qbasicatomic.h:61:4:
error: #error “Qt requires C++11 support” # error “Qt requires C++11
support”

处理方法1

单个模组可以直接修改pro:

QMAKE_CXXFLAGS += -std=c++11

或者直接修改makefile:

CFLAGS        += -std=c++11 
CXXFLAGS      += -std=c++11

处理方法2

交叉编译配置添加:
qt\qt-everywhere-src-5.12.5\qtbase\mkspecs\linux-aarch64-gnu-g++\qmake.conf

QMAKE_CFLAGS +=-std=c++11
QMAKE_CXXFLAGS +=-std=c++11

修改qmake.conf之后,不需要重新交叉编译Qt库,直接make就可以自动更新这些参数。

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值