tomstewart89 / BasicLinearAlgebra

A library for using matrices and linear algebra on Arduino
MIT License
185 stars 38 forks source link

Note that the F matrix in the example clashes with the F() macro #59

Closed drf5n closed 1 year ago

drf5n commented 1 year ago

https://github.com/tomstewart89/BasicLinearAlgebra/blob/26d44b16718ee7663e0290fa1ace40ada99636c2/examples/HowToUse/HowToUse.ino#L96-L98

If you were to try to access F(1,1) you will get an error:

error: macro "F" passed 2 arguments, but takes just 1
     Serial << F(1,1);
                    ^

Or F(1) gets you:

/arduino/hardware/avr/1.8.6/cores/arduino/WString.h:38:74: error: initializer fails to determine size of '__c'
 #define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))
                                                                          ^
sketch.ino:99:15: note: in expansion of macro 'F'
     Serial << F(1);

The F macro is defined here:

https://github.com/arduino/ArduinoCore-avr/blob/master/cores/arduino/WString.h#L38

There's not much to be done, other than avoid F as a variable name.

tomstewart89 commented 1 year ago

Sorry for the slow reply @drf5n , and thanks for the heads up! I'm planning to push a few changes to this library soon so I'll be sure to fix this problem when I do.