Using C++20 with ESP32S3

avsteele
Posts: 2
Joined: Thu Jul 25, 2024 1:34 pm

Using C++20 with ESP32S3

Postby avsteele » Fri Feb 28, 2025 1:13 pm

How can I enable cpp20 usage for Arduino framework code which uses the c++20 standard? Right now the latest I can get it to do is 2017 (what the __cplusplus macro reports). See attached image showing a c++20 feature which make it unable to compile.

I typically use PlatformIO in VSCode but am open to other solutions as well.
Attachments
pio.png
pio.png (90.66 KiB) Viewed 2178 times

chegewara
Posts: 2505
Joined: Wed Jun 14, 2017 9:00 pm

Re: Using C++20 with ESP32S3

Postby chegewara » Thu Mar 06, 2025 10:48 pm

Code: Select all

build_unflags = -std=gnu++11
build_flags =
    -std=gnu++20
Im not sure if its working for C++20 but worked for C++17 for sure.

kondalkolipaka
Espressif staff
Espressif staff
Posts: 269
Joined: Wed Jul 17, 2019 5:26 pm

Re: Using C++20 with ESP32S3

Postby kondalkolipaka » Wed Mar 19, 2025 9:27 am

Hello,

As you’ve asked for other solutions, you can also think about ESP-IDF for your development, and we have VSCode extension for it and it supports latest C++ version as well.

By default, ESP-IDF compiles C++ code with C++23 language standard with GNU extensions (-std=gnu++23).

https://docs.espressif.com/projects/esp ... e-standard

Thanks

Who is online

Users browsing this forum: No registered users and 1 guest