Error compiling for ATmega1284

my sketch compiles for 328p but not Atmega1284
I'm using usbasp(mighty core)
blink uploads and works fine
anyone know how to fix this?

/Users/lee/Library/Arduino15/packages/MightyCore/hardware/avr/2.1.3/cores/MCUdude_corefiles/Arduino.h:126:22: error: statement-expressions are not allowed outside functions nor in template-argument lists
 #define min(a,b)     ({ typeof (a) _a = (a); typeof (b) _b = (b); _a < _b ? _a : _b; })
                      ^
/Users/lee/Desktop/fvduino Atmega1284 Breadboard/fvduino/fvduino.ino:240:23: note: in expansion of macro 'min'
 const uint8_t NALGO = min(99, sizeof(algodata) / sizeof(AlgoDatum));
                       ^~~
Using library EEPROM at version 2.0 in folder: /Users/lee/Library/Arduino15/packages/MightyCore/hardware/avr/2.1.3/libraries/EEPROM 
Using library ButtonEvents-master at version 1.0.1 in folder: /Users/lee/Documents/Arduino/libraries/ButtonEvents-master 
Using library Bounce2 at version 2.56 in folder: /Users/lee/Documents/Arduino/libraries/Bounce2 
Using library Adafruit_NeoPixel at version 1.7.0 in folder: /Users/lee/Documents/Arduino/libraries/Adafruit_NeoPixel 
exit status 1
Error compiling for board ATmega1284.

fvduino.ino (33.1 KB)

Looks like a bug in the MightyCore, min and max shouldn't be non-standard statement-expressions, but function templates:

In order to make all relevant information available to all who are interested in this subject, I'll share a link to @Leetut's issue report in the MightyCore repo:

2 Likes