kopanitsa / web3-arduino

an Arduino (or ESP32) library to use web3 on Ethereum platform.
MIT License
106 stars 46 forks source link

Compile error with macros 'min' and 'max' #8

Open jna380 opened 6 years ago

jna380 commented 6 years ago

Hello,

first of all thanks for sharing, this is a great project especially since there are not many with web3 for arduino out there! Unfortunately I'm getting compiler errors I can't fix even through changing gcc versions:

`...appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\c++\4.8.3\bits\stl_algobase.h:239:56: error: macro "min" passed 3 arguments, but takes just 2

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

and `...appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\c++\4.8.3\bits\stl_algobase.h:260:56: error: macro "max" passed 3 arguments, but takes just 2

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

Does someone have an idea how to fix this? I have tried different fixesI found (like using std::min), but none of them works.

Thanks a lot, jna380

arunseba commented 5 years ago

Hello @jna380 ,

I'm new to this. I also had the same error. Do you have any fix for this issue? FYI, I'm trying in ARDUINO MKR GSM 1400 device. It will be helpful if you have a solution for this

Thanks

pongraczi commented 4 years ago

If you are still need answer, check this:
https://stackoverflow.com/questions/41093090/esp8266-error-macro-min-passed-3-arguments-but-takes-just-2#41094091

In short:
You should add

#undef min
#undef max

right after #include <Arduino.h> in your code to get the STL version working.