rogerclarkmelbourne / Arduino_STM32

Arduino STM32. Hardware files to support STM32 boards, on Arduino IDE 1.8.x including LeafLabs Maple and other generic STM32F103 boards
Other
2.52k stars 1.26k forks source link

Fail to compile due to definition duplication: min() and max() macros. #788

Closed danieltr3s closed 4 years ago

danieltr3s commented 4 years ago

If you include stdlib libraries like, #include \<array>, in your code, you won't be able to compile it as it will produce the following errors:

error: macro "min" passed 3 arguments, but takes just 2

 min(const _Tp& __a, const _Tp& __b, _Compare __comp)

error: macro "max" passed 3 arguments, but takes just 2

 max(const _Tp& __a, const _Tp& __b, _Compare __comp)

Example code:

#include <array>

void setup() {
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:
}

I've have a fix for that and will create a pull request with the fix.

stevstrong commented 4 years ago

Thanks, should be fixed by https://github.com/rogerclarkmelbourne/Arduino_STM32/commit/97b9c4406409de3f0b1dcac7ee0202db55ce8f42