S
Steven T. Hatton
One think I really dislike about the (default?) behavior of gcc is the way
it prints errors to console. This is one such report:
cd /home/hattons/code/c++/sth/vmath/test/ # -*-compilation-*-
Entering directory `/home/hattons/code/c++/sth/vmath/test/'
g++ -o testMatrix3 testMatrix3.cc -I/home/hattons/code/c++
In file included from Matrix3Test.hh:4,
from testMatrix3.cc:1:
/home/hattons/code/c++/sth/vmath/Matrix3.hh:141: error: prototype for `const
sth::vmath::IndexedReference<T, sth::vmath::Matrix3<T>::ORDER>&
sth::vmath::Matrix3<T>:
perator[](const unsigned int&) const' does not
match any in class `sth::vmath::Matrix3<T>'
/home/hattons/code/c++/sth/vmath/Matrix3.hh:96: error: candidate is: const
sth::vmath::IndexedReference<T, sth::vmath::Matrix3<T>::ORDER>&
sth::vmath::Matrix3<T>:
perator[](const unsigned int&) const
/home/hattons/code/c++/sth/vmath/Matrix3.hh:141: error: template definition
of
non-template `const sth::vmath::IndexedReference<T,
sth::vmath::Matrix3<T>::ORDER>& sth::vmath::Matrix3<T>:
perator[](const
unsigned int&) const'
Compilation exited abnormally with code 1 at Fri Oct 8 19:32:56
Now for the fun part. Read the message closely. What it boils down to is
this:
The first line is wrong. You should have used the second line:
IndexedReference<T, Matrix3<T>::ORDER>& Matrix3<T>:
perator[](int&)
IndexedReference<T, Matrix3<T>::ORDER>& Matrix3<T>:
perator[](int&)
Now here's what the problem was. I have a static const unsigned ORDER = 3
in Matrix3<T>. When I try to use that as a template parameter in the
definition of a member function the compiler gets confused. Likewise if I
try to use an enum. And I did qualify it where I used it outside the class
definition.
Anybody want to try and explain /that/?
--
"If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true." - Bertrand
Russell
it prints errors to console. This is one such report:
cd /home/hattons/code/c++/sth/vmath/test/ # -*-compilation-*-
Entering directory `/home/hattons/code/c++/sth/vmath/test/'
g++ -o testMatrix3 testMatrix3.cc -I/home/hattons/code/c++
In file included from Matrix3Test.hh:4,
from testMatrix3.cc:1:
/home/hattons/code/c++/sth/vmath/Matrix3.hh:141: error: prototype for `const
sth::vmath::IndexedReference<T, sth::vmath::Matrix3<T>::ORDER>&
sth::vmath::Matrix3<T>:
match any in class `sth::vmath::Matrix3<T>'
/home/hattons/code/c++/sth/vmath/Matrix3.hh:96: error: candidate is: const
sth::vmath::IndexedReference<T, sth::vmath::Matrix3<T>::ORDER>&
sth::vmath::Matrix3<T>:
/home/hattons/code/c++/sth/vmath/Matrix3.hh:141: error: template definition
of
non-template `const sth::vmath::IndexedReference<T,
sth::vmath::Matrix3<T>::ORDER>& sth::vmath::Matrix3<T>:
unsigned int&) const'
Compilation exited abnormally with code 1 at Fri Oct 8 19:32:56
Now for the fun part. Read the message closely. What it boils down to is
this:
The first line is wrong. You should have used the second line:
IndexedReference<T, Matrix3<T>::ORDER>& Matrix3<T>:
IndexedReference<T, Matrix3<T>::ORDER>& Matrix3<T>:
Now here's what the problem was. I have a static const unsigned ORDER = 3
in Matrix3<T>. When I try to use that as a template parameter in the
definition of a member function the compiler gets confused. Likewise if I
try to use an enum. And I did qualify it where I used it outside the class
definition.
Anybody want to try and explain /that/?
--
"If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true." - Bertrand
Russell