How to resolve "error: no matching function for call to ‘Eigen::Matrix<float, 4, 1>::_init2<Eigen::Matrix<float, 4, 1, 0, 4, 1>, int>(const Eigen::Matrix<float, 4, 1>&, const int&)’"?
When I run catkin_make I get the following error:
In file included from /usr/include/eigen3/Eigen/Core:458,
from /usr/include/pcl-1.10/pcl/pcl_macros.h:75,
from /usr/include/pcl-1.10/pcl/console/parse.h:43,
from /home/shivam/catkin_ws/src/pcl_tutorial/src/random_sample_consensus.cpp:4:
/usr/include/eigen3/Eigen/src/Core/Matrix.h: In instantiation of ‘Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::Matrix(const T0&, const T1&) [with T0 = Eigen::Matrix<float, 4, 1>; T1 = int; _Scalar = float; int _Rows = 4; int _Cols = 1; int _Options = 0; int _MaxRows = 4; int _MaxCols = 1]’:
/home/shivam/catkin_ws/src/pcl_tutorial/src/random_sample_consensus.cpp:372:66: required from here
/usr/include/eigen3/Eigen/src/Core/Matrix.h:302:35: error: no matching function for call to ‘Eigen::Matrix<float, 4, 1>::_init2<Eigen::Matrix<float, 4, 1, 0, 4, 1>, int>(const Eigen::Matrix<float, 4, 1>&, const int&)’
302 | Base::template _init2<T0,T1>(x, y);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/eigen3/Eigen/Core:457,
from /usr/include/pcl-1.10/pcl/pcl_macros.h:75,
from /usr/include/pcl-1.10/pcl/console/parse.h:43,
from /home/shivam/catkin_ws/src/pcl_tutorial/src/random_sample_consensus.cpp:4:
/usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:738:30: note: candidate: ‘void Eigen::PlainObjectBase<Derived>::_init2(Eigen::Index, Eigen::Index, typename Eigen::internal::enable_if<(typename Eigen::internal::dense_xpr_base<Derived>::type::SizeAtCompileTime != 2), T0>::type*) [with T0 = Eigen::Matrix<float, 4, 1>; T1 = int; Derived = Eigen::Matrix<float, 4, 1>; Eigen::Index = long int; typename Eigen::internal::enable_if<(typename Eigen::internal::dense_xpr_base<Derived>::type::SizeAtCompileTime != 2), T0>::type = Eigen::Matrix<float, 4, 1>]’
738 | EIGEN_STRONG_INLINE void _init2(Index rows, Index cols, typename internal::enable_if<Base::SizeAtCompileTime!=2,T0>::type* = 0)
| ^~~~~~
/usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:738:43: note: no known conversion for argument 1 from ‘const Eigen::Matrix<float, 4, 1>’ to ‘Eigen::Index’ {aka ‘long int’}
738 | EIGEN_STRONG_INLINE void _init2(Index rows, Index cols, typename internal::enable_if<Base::SizeAtCompileTime!=2,T0>::type* = 0)
| ~~~~~~^~~~
/usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:748:30: note: candidate: ‘template<class T0, class T1> void Eigen::PlainObjectBase<Derived>::_init2(const T0&, const T1&, typename Eigen::internal::enable_if<(typename Eigen::internal::dense_xpr_base<Derived>::type::SizeAtCompileTime == 2), T0>::type*) [with T0 = T0; T1 = T1; Derived = Eigen::Matrix<float, 4, 1>]’
748 | EIGEN_STRONG_INLINE void _init2(const T0& val0, const T1& val1, typename internal::enable_if<Base::SizeAtCompileTime==2,T0>::type* = 0)
| ^~~~~~
/usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:748:30: note: template argument deduction/substitution failed:
/usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h: In substitution of ‘template<class T0, class T1> void Eigen::PlainObjectBase<Eigen::Matrix<float, 4, 1> >::_init2<T0, T1>(const T0&, const T1&, typename Eigen::internal::enable_if<false, T0>::type*) [with T0 = Eigen::Matrix<float, 4, 1>; T1 = int]’:
/usr/include/eigen3/Eigen/src/Core/Matrix.h:302:35: required from ‘Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::Matrix(const T0&, const T1&) [with T0 = Eigen::Matrix<float, 4, 1>; T1 = int; _Scalar = float; int _Rows = 4; int _Cols = 1; int _Options = 0; int _MaxRows = 4; int _MaxCols = 1]’
/home/shivam/catkin_ws/src/pcl_tutorial/src/random_sample_consensus.cpp:372 ...
Looks Eigen installation is ok but the problem is with a conversion. Check this prior answer: https://answers.ros.org/question/3390...
@osilva I resolved the error. The problem was in the cpp file. I was passing the wrong data type to an Eigen function. I don't why the visual studio code didn't show any error when I open that file. It generally shows these types of errors in the editor itself. So I thought this was a dependency error but it is not.
Glad you found the answer and thank you for recording the answer.