Search code examples
c++g++eclipse-cdt

C++ Error 'nullptr was not declared in this scope' in Eclipse IDE


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.


Solution

  • 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!

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