sketch_may15a:4:52: error: macro "max" requires 2 arguments, but only 1 given
4 | Serial.println(std::numeric_limits<int16_t>::max());
| ^
In file included from /home/fergal/Arduino/libraries/ssd1306/src/ssd1306.h:31,
from /home/fergal/Arduino/sketch_may15a/sketch_may15a.ino:1:
/home/fergal/Arduino/libraries/ssd1306/src/nano_gfx_types.h:40: note: macro "max" defined here
40 | #define max(a,b) ((a)>(b)?(a):(b))
|
exit status 1
macro "max" requires 2 arguments, but only 1 given
The code above is just the simplest repro case. I ran into this in real life because esp8266/StreamString.h contains the following
virtual int availableForWrite() override
{
return std::numeric_limits<int16_t>::max();
}
In general you shouldn't define macros in .h files that will end up included by users of the library unless they are intended to be used by those users (and then naming them becomes tricky).
The following code fails to compile when the
#include
is presentThe error is
The code above is just the simplest repro case. I ran into this in real life because
esp8266/StreamString.h
contains the followingIn general you shouldn't define macros in .h files that will end up included by users of the library unless they are intended to be used by those users (and then naming them becomes tricky).