A few years ago I had to use the MTL 2
library in my career's final project (it was a mandatory requirement). I had to work on an existing (and rather old) code and the compiler I used was g++ 4.4
.
Now, I want to keep working on that project to try and improve it. I want to use some C++11
features and since Debian Wheezy
comes with g++ 4.7
, I think I'll use it.
So, I installed MTL 2
and tried to compile the project. But I got an error reagarding ptrdiff_t
was not known:
error: expected type-specifier before ‘ptrdiff_t’
error: expected ‘>’ before ‘ptrdiff_t’
error: template argument 4 is invalid
Googleing a bit I found that since g++ 4.6
some things changed in the standard headers and that I needed to include the cstddef
header in order to make ptrdiff_t
known (a).
So I included that header into the MTL 2
files that used ptrdiff_t
and recompiled the project. However, a new error appeared:
In file included from /usr/local/include/mtl/matrix.h:41:0,
from /usr/local/include/mtl/mtl2lapack.h:20,
from MCl_Eigen.cpp:36:
/usr/local/include/mtl/envelope2D.h:72:20: error: declaration of ‘typedef struct mtl::twod_tag mtl::envelope2D<T>::dimension’ [-fpermissive]
In file included from /usr/local/include/mtl/matrix_implementation.h:25:0,
from /usr/local/include/mtl/matrix.h:33,
from /usr/local/include/mtl/mtl2lapack.h:20,
from MCl_Eigen.cpp:36:
/usr/local/include/mtl/dimension.h:19:7: error: changes meaning of ‘dimension’ from ‘class mtl::dimension<typename mtl::dense1D<T>::size_type>’ [-fpermissive]
make: *** [MCl_Eigen.o] Error 1
My question is if there's a way to use MTL 2
with the g++ 4.7
compiler or is it better to use a newer version and adapt the code to it? (or use the same compiler as before, g++ 4.4
)
(a) I included the cstddef
header directly into the MTL
files. Should I have done it in the project files instead?