tttapa / Control-Surface

Arduino library for creating MIDI controllers and other MIDI devices.
GNU General Public License v3.0
1.28k stars 140 forks source link

Compiling ex11 button matrix example for MKRZERO #36

Closed brorgustav closed 5 years ago

brorgustav commented 5 years ago

When compiling buttonmatrix.ino:

In file included from /Users/brorgustav/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include/c++/7.2.1/bits/char_traits.h:39:0,
                 from /Users/brorgustav/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include/c++/7.2.1/ios:40,
                 from /Users/brorgustav/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include/c++/7.2.1/ostream:38,
                 from /Users/brorgustav/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include/c++/7.2.1/iterator:64,
                 from /Users/brorgustav/Documents/Arduino/Sketches/libraries/Control-Surface/src/Helpers/LinkedList.hpp:9,
                 from /Users/brorgustav/Documents/Arduino/Sketches/libraries/Control-Surface/src/Display/DisplayInterface.hpp:4,
                 from /Users/brorgustav/Documents/Arduino/Sketches/libraries/Control-Surface/src/Display/DisplayElement.hpp:3,
                 from /Users/brorgustav/Documents/Arduino/Sketches/libraries/Control-Surface/src/Control_Surface/Control_Surface_Class.hpp:7,
                 from /Users/brorgustav/Documents/Arduino/Sketches/libraries/Control-Surface/src/Control_Surface.h:16,
                 from /Users/brorgustav/Documents/Arduino/Sketches/axiom32_ttappa-lib_mkrzero_keyboard/axiom32_ttappa-lib_mkrzero_keyboard.ino:22:
/Users/brorgustav/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include/c++/7.2.1/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
                                                        ^
/Users/brorgustav/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include/c++/7.2.1/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
                                                        ^
Multiple libraries were found for "SPI.h"
 Used: /Users/brorgustav/Documents/Arduino/Sketches/libraries/SPI
 Not used: /Users/brorgustav/Library/Arduino15/packages/arduino/hardware/samd/1.8.3/libraries/SPI
Using library Control-Surface at version 1.0.0 in folder: /Users/brorgustav/Documents/Arduino/Sketches/libraries/Control-Surface 
Using library SPI at version 1.0 in folder: /Users/brorgustav/Documents/Arduino/Sketches/libraries/SPI 
Using library MIDIUSB at version 1.0.4 in folder: /Users/brorgustav/Documents/Arduino/Sketches/libraries/MIDIUSB 
exit status 1
Error compiling for board Arduino MKRZERO.
tttapa commented 5 years ago

Thank you for your issue.

This seems to be an issue with the Arduino Core for the MKRZERO: https://github.com/arduino/ArduinoCore-samd/issues/443

The solution is to replace the macros max and min by template functions. (Or to just #undef them altogether, I don't think I use them anywhere in my code.)

I'll see if I can provide a workaround in this library.