arduino / arduino/ArduinoCore-samd

#include <algorithm> causes a compilation error when compiling for Arduino Due and SAMD

Open
#308 1 comment 0 reactions 0 assignees View on GitHub
Component: Toolchain
Dominant language
C
Stars
502
Forks
740
PR merge metrics
No merged PRs in 30d

Description

When compiled for Due, this sketch

```
#include

void setup() {}
void loop() {}
```
produces this error:

> arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\c++\4.8.3\cstdio:122:11: error: '::printf' has not been declared

It means that sketches targeting Due simply cannot use ``, which is not cool.

Commenting out the line `#undef printf` in the `cstdio` header solves the problem. Hopefully, this will get fixed and we won't have to patch the system headers.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the reported sketch for the Arduino Due and SAMD targets with `#include `, then inspect the `cstdio` header and the interaction with `#undef printf`. Done means the sketch compiles without manually patching the system headers, with the relevant target behavior covered by a regression check if the repository provides one.

Written by the indexing model from the issue text.

Assessment

Tech stack
arduino, cpp
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.