I wrote a template class to handle basic matrix operations.
It compiled fine on Teensy 3.5 until I added an overloaded parenthesis function, after which I am getting the error:
I did not get this error when compiling for Atmega328P and I don't really understanding why I'm getting it now when compiling for Teensy 3.5.
I am using the Arduino IDE and Teensyduino add-on.
Edit: from looking at the error message, it seems that the arguments are passed as reference but the function expects them by value. I did try changing the function to require the arguments by reference but this did not have any effect. But I'm fairly sure I haven't understood this problem correctly.
Any ideas?
Attached:
Matrix.h - the library in question
MatrixWORKING.h - a working version, before I added the overloaded parenthesis operator
Matrix.ino - a sketch that will produce the error (when compiling for Teensy 3.5)
compilation_errors.txt - the full error message
It compiled fine on Teensy 3.5 until I added an overloaded parenthesis function, after which I am getting the error:
Code:
Arduino: 1.8.5 (Windows 10), TD: 1.41, Board: "Teensy 3.5, Serial, 120 MHz, Faster, US English"
In file included from D:\Documents\Arduino\Custom libraries\test_m2\test_m2.ino:1:0:
C:\Program Files (x86)\Arduino\libraries\Matrix/Matrix.h: In instantiation of 'Matrix<T, ROWS_LEFT, COLS_RIGHT> operator*(const Matrix<T, NUM_ROWS, NUM_COLS>&, const Matrix<T, SHARED_DIMENSION, COLS_RIGHT>&) [with T = float; unsigned char ROWS_LEFT = 3u; unsigned char SHARED_DIMENSION = 3u; unsigned char COLS_RIGHT = 1u]':
D:\Documents\Arduino\Custom libraries\test_m2\test_m2.ino:7:13: required from here
C:\Program Files (x86)\Arduino\libraries\Matrix/Matrix.h:263:25: error: no match for call to '(const Matrix<float, 3u, 3u>) (uint8_t&, uint8_t&)'
accumulator += a(i, k) * b(k, j);
I did not get this error when compiling for Atmega328P and I don't really understanding why I'm getting it now when compiling for Teensy 3.5.
I am using the Arduino IDE and Teensyduino add-on.
Edit: from looking at the error message, it seems that the arguments are passed as reference but the function expects them by value. I did try changing the function to require the arguments by reference but this did not have any effect. But I'm fairly sure I haven't understood this problem correctly.
Any ideas?
Attached:
Matrix.h - the library in question
MatrixWORKING.h - a working version, before I added the overloaded parenthesis operator
Matrix.ino - a sketch that will produce the error (when compiling for Teensy 3.5)
compilation_errors.txt - the full error message