问题描述:error: 'nullptr' was not declared in this scope

如图:

error: ‘nullptr‘ was not declared in this scope @FDDLC

从上图可知,nullptr是C++11的关键字!怎么办?换到C++11以上呗!

以Code::Blocks为例,找到Settings->Compiler:

error: ‘nullptr‘ was not declared in this scope @FDDLC

点击进入后勾选这两个:

error: ‘nullptr‘ was not declared in this scope @FDDLC

点击OK完事!

回到项目,要不run一下?

建议先rebuild一下(Ctr+F11),然后再运行(F9)。nullptr的问题应该就解决了。

 

相关文章: