Rosanswers logo

I'm trying to follow this tutorial using ROS hydro medusa:


The code won't compile saying that:

/opt/ros/hydro/include/laser_geometry/laser_geometry.h:46:22: fatal error: Eigen/Core: No such file or directory

I could only find a guide for a migration to ROS fuerte, but those instructions didn't work for me. Does anybody know how to fix this?

EDIT to add details: I created a new package with dependences on roscpp, rospy (probably useless) and std_msgs. I'm using ROS hydro medusa. I then created a cpp source containing this code:

#include "ros/ros.h"
#include "tf/transform_listener.h"
#include "sensor_msgs/PointCloud.h"
#include "tf/message_filter.h"
#include "message_filters/subscriber.h"
#include "laser_geometry/laser_geometry.h"

class LaserScanToPointCloud{


  ros::NodeHandle n_;
  laser_geometry::LaserProjection projector_;
  tf::TransformListener listener_;
  message_filters::Subscriber<sensor_msgs::LaserScan> laser_sub_;
  tf::MessageFilter<sensor_msgs::LaserScan> laser_notifier_;
  ros::Publisher scan_pub_;

  LaserScanToPointCloud(ros::NodeHandle n) : 
    laser_sub_(n_, "base_scan", 10),
    laser_notifier_(laser_sub_,listener_, "base_link", 10)
      boost::bind(&LaserScanToPointCloud::scanCallback, this, _1));
    scan_pub_ = n_.advertise<sensor_msgs::PointCloud>("/my_cloud",1);

  void scanCallback (const sensor_msgs::LaserScan::ConstPtr& scan_in)
    sensor_msgs::PointCloud cloud;
          "base_link",*scan_in, cloud,listener_);
    catch (tf::TransformException& e)
        std::cout << e.what();
    // Do something with cloud.



int main(int argc, char** argv)
  ros::init(argc, argv, "my_scan_to_cloud");
  ros::NodeHandle n;
  LaserScanToPointCloud lstopc(n);
  return 0;

At this point, I added these two lines at the end of CMakeLists.txt as I always did with sources:

add_executable(laser_scan_to_point_cloud src/laser_scan_to_point_cloud.cpp)
target_link_libraries(laser_scan_to_point_cloud ${catkin_LIBRARIES})

However, I'm getting the error that I told you when I try to compile with catkin_make. I tried to use rosdep, but it says that all the dependencies have been correctly installed. I also tried with an offline roswtf, but it doesn't find anything. Here are the versions:

rosversion -d: hydro

rosversion roscpp: 1.10.2

rosversion laser_geometry: 1.5.15

rosversion std_msgs: 0.5.8

Please let me know if you need other information!

Originally posted by lucaluca on ROS Answers with karma: 74 on 2014-07-10

Post score: 0

Original comments

Comment by tfoote on 2014-07-10:
Please provide more context as to how to reproduce your problem. Those should be system libraries installed on your computer as a dependency of the package where the file is erroring. It could be something like you're overriding the include path.

Comment by lucaluca on 2014-07-11:
Thanks for your help. I added all the details that came to my mind. If you need other please let me know. As far as I know, the problem is that I'm missing the "eigen" package, but the point is that that package isn't available since ROS fuerte, since you can find migration instructions TO fuerte


1 Answer 1


Rosanswers logo

If you're using Ubuntu, then do the following.

sudo apt-get install libeigen3-dev

Otherwise, you can always build from source.

~ $ wget http://bitbucket.org/eigen/eigen/get/3.2.1.tar.bz2
~ $ tar -xjf 3.2.1.tar.bz2
~ $ cd eigen-eigen-6b38706d90a9
~/eigen-eigen-6b38706d90a9 $ mkdir build && cd build && cmake ../
~/eigen-eigen-6b38706d90a9 $ sudo make install
~/eigen-eigen-6b38706d90a9 $ sudo ldconfig

After you've installed eigen (hopefully the first way), you should be able to build the code. Unless some other dependency pops up... In which case, feel free to comment.

Originally posted by allenh1 with karma: 3055 on 2014-07-11

This answer was ACCEPTED on the original site

Post score: 2

Original comments

Comment by lucaluca on 2014-07-13:
Thank you for your help! I'm now getting an even stranger error now. Let me know if you can help me. EDIT: I added the new error at the end of my original question

Comment by lucaluca on 2014-07-14:
@allenh1 my fault, I forgot to import the tf library. Thanks a lot!! :)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.