I use Eigen library in my C++ project and I don't understand how to pass an Eigen::Vector in parameter of my function.
I have in my main function :
Eigen::Vector<double, 3> direction_vector_ned = {1.0, 2.0, 3.0};
Eigen::Vector<double, 3> direction_vector_lla = Reperes::ned_to_lla(direction_vector_ned);
In my Reperes class :
class Reperes
{
private:
public:
static Eigen::Vector<double, 3> ned_to_lla(const Eigen::Vector<double, 3>& ned);
};
And the implementation match with the prototype :
static Eigen::Vector<double, 3> ned_to_lla(const Eigen::Vector<double, 3>& ned)
{
Eigen::Vector<double, 3> lla = {0.0, 0.0, 0.0};
...
return lla;
}
I think the architecture is correct but the compiler raise an error at the call of ned_to_lla() in my main.
I got this error :
undefined reference to `Reperes::ned_to_lla(Eigen::Matrix<double, 3, 1, 0, 3, 1> const&)
I explicitly declared my direction_vector_ned variable as a Vector<double, 3>. Why it has been casted into a Matrix<double, 3, 1, 0, 3, 1> ?
I tried to use EigenBase type as mentionned in this section https://eigen.tuxfamily.org/dox/TopicFunctionTakingEigenTypes.html but it didn't work.
Matrixhas default parameter, soEigen::Vector<double, 3>ISMatrix<double, 3, 1, 0, 3, 1>Reperes::ned_to_lla" You define the free function::ned_to_lla