1720
2019-05-31 11:41:46 +0000
Eigen leaves macro I defined
2019-12-04 18:40:10 +0000
1
1
1
Unclassified
Eigen
General
3.3 (current stable)
All
Linux
DECISIONNEEDED
Normal
Compilation Problem
---
1
djordjezivanovicva
eigen.nobody
chtz
gael.guennebaud
jacob.benoit.1
oldest_to_newest
8151
0
djordjezivanovicva
2019-05-31 11:41:46 +0000
I have tried using LAPACK + BLAS + Eigen following the instructions https://eigen.tuxfamily.org/dox/TopicUsingBlasLapack.html .
However, when I define EIGEN_USE_BLAS and EIGEN_USE_LAPACKE and have the following order in the first header file:
#include <boost/thread/barrier.hpp>
#include <Eigen/Dense>
the following compilation error appears:
In file included from /usr/include/c++/7/complex.h:36:0,
from /usr/local/include/Eigen/src/misc/lapacke.h:79,
from /usr/local/include/Eigen/LU:34,
from /usr/local/include/Eigen/Dense:2,
from xxx.h:4,
from xxx.cpp:5:
/usr/local/include/boost/type_traits/integral_constant.hpp:34:20: error: expected identifier before ‘(’ token
template <class I, I val> struct integral_c;
^
/usr/local/include/boost/type_traits/integral_constant.hpp:34:20: error: expected ‘)’ before ‘__extension__’
template <class I, I val> struct integral_c;
^
/usr/local/include/boost/type_traits/integral_constant.hpp:34:20: error: expected ‘>’ before ‘__extension__’
/usr/local/include/boost/type_traits/integral_constant.hpp:34:20: error: expected unqualified-id before ‘)’ token
template <class I, I val> struct integral_c;
I tracked the origin of this compiler error and it is from
#include <complex.h> that defines I. (https://en.wikibooks.org/wiki/C_Programming/complex.h)
I successfully circumvent the problem by adding #undef I after #include<Eigen/Dense>, but you should solve this problem for future releases of Eigen.
8152
1
chtz
2019-05-31 14:58:33 +0000
This seems to be rather a problem with `complex.h` and boost. AFAIK, Eigen itself completely avoids using `I` as an identifier.
OTOH, we probably don't break much, if we `#undef I`. Another (probably better) approach could be to add this before including lapacke.h (thus avoiding to include "complex.h"):
#ifndef lapack_complex_float
#define lapack_complex_float std::complex<float>
#endif
#ifndef lapack_complex_double
#define lapack_complex_double std::complex<double>
#endif
8153
2
gael.guennebaud
2019-06-04 14:31:21 +0000
Defining lapack_complex_* seems to be fine, at leat for my setup.
8155
3
chtz
2019-06-05 08:42:38 +0000
Can we just modify lapacke.h? (It looks like something auto-generated by MKL)
Otherwise, we need to wrap this by another small header.
10164
4
eigen.nobody
2019-12-04 18:40:10 +0000
-- GitLab Migration Automatic Message --
This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1720.