C ++错误“nullptr未在此范围中声明”在Eclipse IDE中 [英] C++ Error 'nullptr was not declared in this scope' in Eclipse IDE

查看:2068
本文介绍了C ++错误“nullptr未在此范围中声明”在Eclipse IDE中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行Eclipse Helios,我安装了g ++ - 4.6。希望我没有错,g ++ 4.6实现C ++ 11的功能。我创建了一个C ++项目,它使用nullptr和auto关键字。该构建会产生以下错误: -

I am running Eclipse Helios and I have g++-4.6 installed. Hope I am not wrong that g++4.6 implements C++ 11 features. I have created a C++ project which uses the nullptr and auto keywords. The build gives the following errors:-

../{filename}.cpp:13:13: error: ‘nullptr’ was not declared in this scope

../{filename}.cpp:14:2: warning: ‘auto’ will change meaning in C++0x; please remove it [-Wc++0x-compat]

实际上它直到昨天才建好。我今天从无处得到这些。请帮我解决这个问题。

Actually it was building fine until yesterday. I am getting these from nowhere today. Please help me solve this problem.

推荐答案

最后找到了什么。在项目属性 - > C / C ++构建 - >设置 - > GCC C ++编译器 - >其他中添加了-std = c ++ 0x编译器参数。它现在工作了!

Finally found out what to do. Added the -std=c++0x compiler argument under Project Properties -> C/C++ Build -> Settings -> GCC C++ Compiler -> Miscellaneous. It works now!

但是如何为所有C ++项目默认添加这个标志?任何人?

But how to add this flag by default for all C++ projects? Anybody?

这篇关于C ++错误“nullptr未在此范围中声明”在Eclipse IDE中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆