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

undefined reference errors when using cross product

Tags: None
(comma "," separated)
lucasw
Registered Member
Posts
3
Karma
0
This code:
Code: Select all
Eigen::Matrix3d new_cb_n;
//... set contents of new_cb_n
 new_cb_n.row(1) = new_cb_n.row(2).cross(new_cb_n.row(0));


gives me this error:

Code: Select all
undefined reference to `Eigen::Matrix<double, 1, 3, 2, 1, 3> Eigen::MatrixBase<Eigen::Block<Eigen::Matrix<double, 3, 3, 2, 3, 3>, 1, 3, 1, 32> >::cross<Eigen::Block<Eigen::Matrix<double, 3, 3, 2, 3, 3>, 1, 3, 1, 32> >(Eigen::MatrixBase<Eigen::Block<Eigen::Matrix<double, 3, 3, 2, 3, 3>, 1, 3, 1, 32> > const&) const'


Also I can change it to
Code: Select all
new_cb_n.row(1) = new_cb_n.row(3).cross(new_cb_n.row(0));

which will compile but crash during runtime.

I'm using the version of Eigen that is in the latest ROS, not sure if it is much different but I'll take the question to the ROS mailing list next. Can anyone tell me what is going wrong?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
are you sure you #include <Eigen/Geometry> ?? here the following compiler and run fine:

Code: Select all
#include <iostream>
#include <Eigen/Geometry>
using namespace Eigen;

int main()
{
  Eigen::Matrix3d new_cb_n;
  new_cb_n << 1, 2, 3, 4, 5, 6, 7, 8, 9;
  new_cb_n.row(1) = new_cb_n.row(2).cross(new_cb_n.row(0));
  std::cerr << new_cb_n << "\n";

  return 0;
}
lucasw
Registered Member
Posts
3
Karma
0
That worked, thanks! I was only including Eigen/Core.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]