U
user
I am trying to port a simple vector/matrix class library to mingw
(v3.4.2). I have used this library with no problem on MSVC++ v6 for a
number of years. My difficulty is that it does not compile under g++!
Two issues:
Firstly, if I define x to be a CColumnVector, y to be a CRowVector and M
to be a CMatrix (of the right size!) then:
M = x * y;
works fine with both compilers where:
CMatrix operator *(CColumnVector& a, CRowVector& b);
But for:
M = Transpose(y) * y;
where CColumnVector Transpose(CRowVector& a);
g++ gives me "error: no match for 'opertator*' in
Transpose(CRowVector&)() * y" followed by a list of 11 candidates
including the correct function. MSVC++ has no problem with this and can
correctly interpret the context of the CColumnVector returned by the
Transpose function. g++ it appears, cannot!
Second, if I have:
A = B * C * D;
where A..D are matrices and where:
CMatrix operator *(CMatrix& A, CMatrix& B);
g++ gags with
"error: no match for 'opertator*' in 'operator*(CMatrix&,CMatrix&)
(((CMatrix&) (&C))) * D'"
and again, presents a long list of possibilities including the correct
function. MSVC++ sails through no problem.
In fact, it seems g++ is not happy about multiplying three matrices (or
more) although it's happy with two! Which is a rather constrained
version of overloading...
Anybody any ideas on solving either/both of these problems?
Cheers,
Peter
(v3.4.2). I have used this library with no problem on MSVC++ v6 for a
number of years. My difficulty is that it does not compile under g++!
Two issues:
Firstly, if I define x to be a CColumnVector, y to be a CRowVector and M
to be a CMatrix (of the right size!) then:
M = x * y;
works fine with both compilers where:
CMatrix operator *(CColumnVector& a, CRowVector& b);
But for:
M = Transpose(y) * y;
where CColumnVector Transpose(CRowVector& a);
g++ gives me "error: no match for 'opertator*' in
Transpose(CRowVector&)() * y" followed by a list of 11 candidates
including the correct function. MSVC++ has no problem with this and can
correctly interpret the context of the CColumnVector returned by the
Transpose function. g++ it appears, cannot!
Second, if I have:
A = B * C * D;
where A..D are matrices and where:
CMatrix operator *(CMatrix& A, CMatrix& B);
g++ gags with
"error: no match for 'opertator*' in 'operator*(CMatrix&,CMatrix&)
(((CMatrix&) (&C))) * D'"
and again, presents a long list of possibilities including the correct
function. MSVC++ sails through no problem.
In fact, it seems g++ is not happy about multiplying three matrices (or
more) although it's happy with two! Which is a rather constrained
version of overloading...
Anybody any ideas on solving either/both of these problems?
Cheers,
Peter