max() and min() functions not available

Really strange. Even redefining the max macro in the program did not work for me. I tried the following:

#undef max
#define max(a,b) ((a)>(b)?(a):(b))
void setup()
{
  int z = max(10,5);
}

Still received an error that max was not defined. I looked and it is defined in the wiring_constant.h file in the SAMD core directory.

It's a bug but I don't know why. As a temp solution you could try the following:

inline int max(int a,int b) {return ((a)>(b)?(a):(b)); }
void setup()
{
  int z = max(10,5);
}