C++17 revisited

Compiling Mbed-os with gcc and C++ >14 is working fine. With ARMC6 in Mbed Studio, I get some errors that I cannot resolve when changing “-std=c++17”, e.g. ./mbed-os/platform/cxxsupport\mstd_mutex:309:12: error: no member named 'scoped_lock' in namespace 'std'
The bunch of warnings can be ommitted by adding "-Wno-deprecated-volatile"to the compiler profiles.
I have checked als the documentation, it says the clib does not include C11 additions. I want to use aligned_alloc() wich is useful for M7 cache handling, but it looks that the compiler is behind the standards.
Its bad that Mbed as C++ OS is not at least at C++17 standard.

Hello @JojoS ,

It seems you probably need to specify the thread supporting version of the standard library. Please specify in your command line:
-D_ARM_LIBCPP_EXTERNAL_THREADS -Wl,--stdlib=threaded_libc++ --std=c++17

Please see the following AC6 docs for more info:
Support for this is ALPHA quality.

We can confirm, that aligned_alloc() is not implemented.

Kind regards,
Aleksandra - Studio team

1 Like

thanks for your fast reply, I will try it.