zl程序教程

您现在的位置是:首页 >  工具

当前栏目

Ubuntu20.04下qt交叉编译报错::15: error: ‘nullptr‘ was not declared in this scope

Qt 报错 Error in not 编译 15 this
2023-09-14 09:09:33 时间

一、问题描述。

Ubuntu20.04下qt交叉编译报错:“:15: error: 'nullptr' was not declared in this scope”,使用的qtcreator版本为4.11.0。

:15: error: 'nullptr' was not declared in this scope

二、问题分析。

nullptr是C++11引入的关键字,nullptr为-std=c++11及更高版本所支持,而交叉编译工具不支持c++11。查看.pro文件,可以看到“#CONFIG += c++11”,高版本的qtcreator新建工程已默认使用c++11。

三、解决方案。

1、升级交叉编译工具,支持c++11,如arm-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2。但同时设备的c++库也须做对应的升级。

2、降级,不要使用C++11特性,调整与C++11相关的代码。