Cannot use C++17/20 with Raspberry Pi Pico (conflicts with abs macro)

Hello, I’m very new to platformIO. I’m trying to build a project for my Raspberry Pi PIco and I was wondering if I could use C++17/20 for it. However, it seems like there are some conflicts with the abs macro. Here is my platformio.ini file:

[env:pico]
platform = raspberrypi
board = pico
framework = arduino

build_flags =
-std=gnu++17
build_unflags =
-std=gnu++11
-std=gnu++14

My main.cpp is completely empty (it just includes Arduino.h):

#include “Arduino.h”
void setup() {}
void loop() {}

However, when I try to build the project, tons of errors are encountered, the first one being related to abs macro (I believe all other ones are related to that one specific error). Here’s a part of the log:

It seems Arduino.h redefines abs macro and it conflicts with the stdlib (for C++17/20).
Would you happen to know whether I can use C++17/20 for my project? If so, how can I achieve that?

Thanks in advance!

Please ask https://github.com/arduino/ArduinoCore-mbed at their issue page to make their code compilable with C++17.

Alright, I added an issue about it on their Github, I’ll update this post accordingly to their answer. :+1: