PlatformIO Community

C++17 support for ESP

I am working on writing a program for the nodemcu ESP8266, and I would like to use some features from C++17. However, adding this to the build flags doesn’t work as the native g++ compiler is pretty outdated (thanks to arduino). Is it possible to use C++17 in this context? If so, how would I go about doing that?

This is the ini file I tried to use by the way, but as expected the ‘-std=c++17’ flag is not recognized.

platform = espressif8266
board = nodemcuv2
framework = arduino
build_unflags = -std=c++11
build_flags = -std=c++17

I’m still wondering if this would even be possible without too much trouble. I would greatly appreciate any help in the matter :slight_smile:

Espressif has recently released a new toolchain based on gcc/g++ 8, which supports C++ 17. It goes along with release 4 of their ESP-IDF framework. As it is still in beta, the framework and the associated toolchain haven’t been integrated into PlatformIO.

There might be some trick to use the new toolchain with PlatformIO already now. But I’m not a specialist for it and likely it would reveal incompatibilities and cause problems.

So you have two options:

  1. Wait until ESP-IDF 4.0 has been released and integrated into PlatformIO. I haven’t seen a roadmap from Espressif. So it’s difficult to tell when it will happen.

  2. Use the ESP-IDF 4.0 beta framework and the new toolchain without PlatformIO.


Thanks a lot! I’ll check it out!