arduino / arduino/ArduinoCore-samd

Unable to #include <memory> - compilation errors within (MKRZero)

Open
#443 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
C
Stars
502
Forks
740
PR merge metrics
No merged PRs in 30d

Description

Hello,
I tried importing to use smart pointers in my sketch (however advisable).
I've seen that they are used on Arduino ([forum post](https://forum.arduino.cc/index.php?topic=591561.0) mentioning their use), so I was confident I could just include it. I receive these compilation errors:

```
In file included from /home/pat/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include/c++/7.2.1/memory:62:0,
from /home/pat/.../projectName.ino:1:
/home/pat/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include/c++/7.2.1/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
/home/pat/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include/c++/7.2.1/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
```

The issue can be recreated on Arduino IDE 1.8.9 and an hourly build from today, just by creating an empty sketch and putting
`#include `
at the top, and choosing MKRZero. The issue doesn't occur when picking Arduino Due.

I also apologise if I've filed this issue in the incorrect place.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with an empty MKRZero sketch containing only #include , then compare it with the Arduino Due result. Start by tracing the MKRZero core's min and max definitions against the arm-none-eabi-gcc errors; done means the minimal MKRZero sketch compiles successfully with included.

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
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.