Firstly, only gcc 4.7 and higher (and therefore avr-gcc 4.7 and higher) support C++11 . So check out the versions installed with:
gcc --version avr-gcc --version
If avr-gcc is 4.7 or higher, you can use C++11 .
Arduino IDE does not support special compiler flags. This is requested but not yet implemented.
Thus, you just have to use other environments or compile your program directly from the command line.
If compiling directly from the command line using avr-gcc you just need to add an additional compiler flag to enable C ++ 11 support.
-std=c++11
For specific development environments, most of them will support editing compiler flags from build options in the IDE. The above flag needs to be added to the list of flags for each environment.
C++0x was the name of a working draft of the C++11 standard. C++0x gcc 4.3 support available. However, this is strictly experimental support, so you cannot expect the expected C++11 features. Here is a complete list of features available with the corresponding version of gcc . The availability of functions in avr-gcc will be the same as in the corresponding version of gcc .
Compiler flag for C++0x :
-std=c++0x
asheeshr Apr 12 '13 at 16:56 2013-04-12 16:56
source share