arduino / arduino/ArduinoCore-mbed
Support for C++17/20
- Dominant language
- C
- Stars
- 411
- Forks
- 225
- PR merge metrics
- No merged PRs in 30d
Description
Hello, 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.
My `main.cpp` file is completely empty (it just includes `Arduino.h` header):
```cpp
#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 below:

It seems `Arduino.h` header redefines `abs` macro and it conflicts with the stdlib (for C++17/20).
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the empty main.cpp example and Arduino.h, then reproduce the Raspberry Pi Pico build using C++17 or C++20 and inspect the first abs macro error in the build log. Done means the minimal sketch builds successfully under the requested standard without the stdlib conflict or resulting errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100