How can I use a C++11 to program the Arduino?

As of version 1.6.6, the Arduino IDE enables C++11 by default.

For older versions, read on:

It is very easy to change the flags for any element of the toolchain, including the assembler, compiler, linker or archiver.

Tested on the Arduino IDE version 1.5.7 (released on July 2014),

  1. Locate the platform.txt file,
  • AVR architecture => {install path}\hardware\arduino\avr\platform.txt
  • SAM architecture => {install path}\hardware\arduino\sam\platform.txt
  1. Inside that file, you can change any flag, for instance,
  • compiler.c.flags for changing the default compilation flags for C++ files.
  • compiler.cpp.flags for changing the default compilation flags for C++ files.
  1. You can also change any of the "recipes" or compile patters, at the corresponding section of the configuration file, under the title "AVR/SAM compile patterns".
  2. After making the changes, you must restart the Arduino IDE, at least on version 1.5.7.

For instance,

To enable support for C++11 (C++0x), tested on Arduino IDE versions 1.5.7 and 1.5.8, you will simply add the flag "-std=gnu++11" at the end of the line starting with compiler.cpp.flags=".

It is expected that C++11 is enabled by default in the near future on the Arduino IDE. However, as of version 1.5.8 (Oct 2014) it is still not the case.


Arduino IDE 1.6.6 and newer have C++11 enabled by default (they have the compiler flag "-std=gnu++11" set in the platform.txt file).


Firstly, only GCC 4.7 and above (and therefore AVR-GCC 4.7 and above) support C++11. So, check the versions installed with:

gcc --version
avr-gcc --version

If AVR-GCC is 4.7 or higher, then you may be able to use C++11.

The Arduino IDE does not support custom compiler flags. This has been requested, but has not yet been implemented.

So, you are left with having to use other environments or to compile your program directly from the command line.

In case, of compiling directly from the command line using AVR-GCC, you simply need to add an extra compiler flag for enabling C++11 support.

-std=c++11

For specific development environments, most would support editing of the compiler flags from the build options within the IDE. The above mentioned flag needs to be added to the list of flags for each environment.


C++0x was the name of working draft of the C++11 standard. C++0x support is available GCC 4.3 onwards. However, this is strictly experimental support so you cannot reliably expect C++11 features to be present. Here is the complete list of features available with the corresponding version of GCC. The availability of features in AVR-GCC will be the same as what's available in the corresponding GCC version.

The compiler flag for C++0x is:

-std=c++0x