Arm Mbed and Pelion Device Management support forum

What's the C++ version for mbedOS?

C++ has multiple versions, such as 2007/2011/2014, what’s the version for mbedOS?
For embedded system, the memory is limited, so the C++ library been support and what’s the limitation of features?

1 Like

Hi David,

We will be targeting C++11, but not all of our supported compilers have a C++11 standard library yet.

In practice that means we are currently targeting C++98 (functionally equivalent to C++03), and intend to turn on some useful C++11 features over time.

We don’t support the use of exceptions (because of the need to allocate memory from an exception context), which means you have to be careful when using some common C++ patterns.

1 Like

@jamcro01 Is it possible for me to add an extra compile flag for my source directory in module.json or something to compile using c++11 ?

It is – if you add this in a file called, for example enablecpp11.cmake in your source directory, it should enable c++11 when compiling your module’s sources. Note that you still won’t be able to use c++11 features safely in your module’s header files:

(remember to change your-module-name-here to your actual module name)

check_cxx_compiler_flag("-std=c++11" CPP11_SUPPORTED)

        PROPERTIES COMPILE_FLAGS "-std=c++11"
    message(STATUS "${CMAKE_CXX_COMPILER} does not support c++11, please use a different compiler!")

Awesome! Thanks for the quick response.

Any ideas of what those features will be ?

if you add this in a file called, for example enablecpp11.cmake in your source directory,

  • online mbed compiled disallow to create a file with such extension.

If you build with the mbed toolchain, create a custom build profile and set:

        "cxx": [

Don’t know if this will work in the online compiler.