Re: compilation of Matrix Template Library for Win32 executable
Alexander Dreyer <[email protected]>
| Newsgroups | gmane.comp.lib.mtl.devel |
|---|---|
| Organization | Fraunhofer ITWM |
| Message-ID | <[email protected]> |
To Robert M Dorazio,
Hi,
actually there are a few problems, I also had to deal with. The major
problem is that mingw always uses a header file called windefs.h.
windefs.h defines a macro PACKED and hence PACKED, used as enumeration
member by mtl, is not valid any more. If you can ensure, that mingw does
not use the macro during the compilation of your program, you can add
the following lines - _before_ include the mtl resources:
#ifdef PACKED
# undef PACKED
#endif
But you still may get in trouble (as I did). So I prefere the following
patch to matrix.h and matrix_traits.h: (I hope, this is the correct
format for a patch...)
matrix.h
***************
*** 423,429 ****
template <int MemLoc=internal>
struct packed {
typedef int size_type;
! enum { id = PACKED, oned_id, ext=MemLoc, issparse=0, index };
};
//: Banded view storage type selectors
--- 423,429 ----
template <int MemLoc=internal>
struct packed {
typedef int size_type;
! enum { id = MTLPACKED, oned_id, ext=MemLoc, issparse=0, index };
};
//: Banded view storage type selectors
***************
*** 680,686 ****
Storage_index,M,N>,
typename IF< EQUAL< Storage_id, ENVELOPE >::RET,
gen_envelope2D<T,M,N>,
! typename IF< EQUAL< Storage_id, PACKED >::RET,
gen_dense2D<T, gen_packed_offset<M,N>,M,N>,
typename IF< EQUAL< Storage_id, BAND >::RET,
gen_dense2D<T, gen_banded_offset<M,N>,M,N>,
--- 680,686 ----
Storage_index,M,N>,
typename IF< EQUAL< Storage_id, ENVELOPE >::RET,
gen_envelope2D<T,M,N>,
! typename IF< EQUAL< Storage_id, MTLPACKED >::RET,
gen_dense2D<T, gen_packed_offset<M,N>,M,N>,
typename IF< EQUAL< Storage_id, BAND >::RET,
gen_dense2D<T, gen_banded_offset<M,N>,M,N>,
***************
*** 710,716 ****
Storage_index,M,N>,
typename IF< EQUAL< Storage_id, ENVELOPE >::RET,
gen_envelope2D<T,M,N>,
! typename IF< EQUAL< Storage_id, PACKED >::RET,
gen_external2D<T,
gen_packed_offset<M,N>,M,N>,
typename IF< EQUAL< Storage_id, BAND >::RET,
gen_external2D<T,
gen_banded_offset<M,N>,M,N>,
--- 710,716 ----
Storage_index,M,N>,
typename IF< EQUAL< Storage_id, ENVELOPE >::RET,
gen_envelope2D<T,M,N>,
! typename IF< EQUAL< Storage_id, MTLPACKED >::RET,
gen_external2D<T,
gen_packed_offset<M,N>,M,N>,
typename IF< EQUAL< Storage_id, BAND >::RET,
gen_external2D<T,
gen_banded_offset<M,N>,M,N>,
***************
matrix_traits.h
*** 7,13 ****
namespace mtl {
enum { RECT, BAND, TRI, SYMM, HERM, ROW_MAJOR, COL_MAJOR, DIAG,
DENSE,
! PACKED, BAND_VIEW, SPARSE, ARRAY, ENVELOPE,
COMPRESSED, SPARSE_PAIR, TREE, LINKED_LIST,
upper, lower, unit_upper, unit_lower, dynamic_uplo,
internal = 0, external,
--- 7,13 ----
namespace mtl {
enum { RECT, BAND, TRI, SYMM, HERM, ROW_MAJOR, COL_MAJOR, DIAG,
DENSE,
! MTLPACKED, BAND_VIEW, SPARSE, ARRAY, ENVELOPE,
COMPRESSED, SPARSE_PAIR, TREE, LINKED_LIST,
upper, lower, unit_upper, unit_lower, dynamic_uplo,
internal = 0, external,
This patch replaces all occuriencies of PACKED in mtl ny MTLPACKED. I
think this should be no problem, since PACKED seems to be used only
internally by mtl. (Please tell me, if this is not correct - or if there
is a better way to fix.)
> c:/mtl-2.1.2-20/mtl/abs.h: In function `double std::abs(double)':
> c:/mtl-2.1.2-20/mtl/abs.h:8: redefinition of `double std::abs(double)'
> c:/MinGW/include/c++/3.2/cmath:87: `double std::abs(double)' previously
> defined here
This just means that your compiler is new enough to have std::abs, but
you have to tell it to mtl, by using the command line parameter
-DHAVE_STD_ABS
or defining the corresponding macro within your program (again befor
including mtl) by
#define HAVE_STD_ABS
(Eventually you may also have to use -DMTL_CMPLR_HAS_LIMITS.)
> c:/mtl-2.1.2-20/mtl/entry.h: In function `mtl::elt_ref<OneD>::value_type
> mtl::operator+(const mtl::elt_ref<T>&, const mtl::elt_ref<U>&)':
> c:/mtl-2.1.2-20/mtl/entry.h:255: warning: `typename
> mtl::elt_ref<OneD>::value_type' is implicitly a typename
This is just a warning, which can be ignored. I can't reproduce this
warning, but maybe it's obsolete after fixing the other errors or by
switching to mtl-2.1.2-21.
By the way, one should first switch to mtl-2.1.2-21 before using the
patch.
Sincerely
Alexander Dreyer
_______________________________________________
This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/