This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Ambigous compilation for "Eigen::VectorXi(0)"

Tags: None
(comma "," separated)
wlambert
Registered Member
Posts
2
Karma
0
Hi all,

I'm on the progress of upgrading a bunch of code (gcc/linux distrib/frameworks/... so quite everything changed) and something that used to compile doesn't compile anymore :

I isolated the problem to the following lines :

#define EIGEN_DONT_ALIGN
#define EIGEN_DONT_VECTORIZE
#include <Eigen/Core>
#include <Eigen/Geometry>

Eigen::VectorXi(0);


Which generates the following build log :

[100%] Building CXX object src/eigen/CMakeFiles/arp_core-eigen.dir/Truc.cpp.o
/home/ard/ard_ros_wkspace/src/ard/arp_core/src/eigen/Truc.cpp: In constructor ‘Truc::Truc()’:
/home/ard/ard_ros_wkspace/src/ard/arp_core/src/eigen/Truc.cpp:13:29: error: call of overloaded ‘Matrix(int)’ is ambiguous
Eigen::VectorXi((int)(0));
^
/home/ard/ard_ros_wkspace/src/ard/arp_core/src/eigen/Truc.cpp:13:29: note: candidates are:
In file included from /usr/include/eigen3/Eigen/Core:294:0,
from /home/ard/ard_ros_wkspace/src/ard/arp_core/src/eigen/Truc.hpp:11,
from /home/ard/ard_ros_wkspace/src/ard/arp_core/src/eigen/Truc.cpp:8:
/usr/include/eigen3/Eigen/src/Core/Matrix.h:284:25: note: Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::Matrix(const Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>&) [with _Scalar = int; int _Rows = -1; int _Cols = 1; int _Options = 0; int _MaxRows = -1; int _MaxCols = 1]
EIGEN_STRONG_INLINE Matrix(const Matrix& other)
^
In file included from /usr/include/eigen3/Eigen/Core:305:0,
from /home/ard/ard_ros_wkspace/src/ard/arp_core/src/eigen/Truc.hpp:11,
from /home/ard/ard_ros_wkspace/src/ard/arp_core/src/eigen/Truc.cpp:8:
/usr/include/eigen3/Eigen/src/Core/Map.h:184:8: note: Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::Matrix(const Scalar*) [with _Scalar = int; int _Rows = -1; int _Cols = 1; int _Options = 0; int _MaxRows = -1; int _MaxCols = 1; Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::Scalar = int]
inline Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>
^
In file included from /usr/include/eigen3/Eigen/Core:294:0,
from /home/ard/ard_ros_wkspace/src/ard/arp_core/src/eigen/Truc.hpp:11,
from /home/ard/ard_ros_wkspace/src/ard/arp_core/src/eigen/Truc.cpp:8:
/usr/include/eigen3/Eigen/src/Core/Matrix.h:220:34: note: Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::Matrix(Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::Index) [with _Scalar = int; int _Rows = -1; int _Cols = 1; int _Options = 0; int _MaxRows = -1; int _MaxCols = 1; Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::Index = long int]
EIGEN_STRONG_INLINE explicit Matrix(Index dim)
^
make[2]: *** [src/eigen/CMakeFiles/arp_core-eigen.dir/Truc.cpp.o] Error 1
make[1]: *** [src/eigen/CMakeFiles/arp_core-eigen.dir/all] Error 2
make: *** [all] Error 2



Could anyone help me with this strange problem ?
jitseniesen
Registered Member
Posts
204
Karma
2
This is probably caused by upgrading Eigen. The type of indices for matrices changed between Eigen 2 and Eigen 3, making Eigen::VectorXi(0) ambiguous: is 0 here a dimension or the null pointer? The easiest way to fix this is to leave out the argument as the size of a matrix defaults to zero, so replace VectorXi(0) by VectorXi().
wlambert
Registered Member
Posts
2
Karma
0
Hum... this is a bit **** but

Thanks !


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot]