ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Based on ROS, I want to run a cpp file which use Eigen

asked 2016-02-01 09:21:28 -0600

ZYS gravatar image

updated 2016-02-01 10:03:11 -0600

gvdhoorn gravatar image

Since the matrix geometry is complicated on C++, I download Eigen online and type #include <Eigen\Dense> in my cpp code file. Based on Visual Studio, I can just add path of Eigen by modifying the property of project. However, I want to run the cpp file on Ros and I cannot add path by modifying the property of project just like the visual studio. I have no idea. Please help me.

edit retag flag offensive close merge delete


More info would help. Which OS and ROS version are you using? Do you have a workspace with packages that you run? Can you provide a minimal example of what you would like to do? Which commands are you running that fail and what is the output?

Thomas D gravatar image Thomas D  ( 2016-02-01 10:03:30 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-02-01 10:14:48 -0600

In order to use Eigen in a ROS package (on Indigo and newer), you will need to edit your package.xml and CMakeLists.txt. Basically you need to depend on the cmake_modules package, and then you can use standard find_package(Eigen REQUIRED) in your CMakeLists.txt. More about this can be read on the Indigo migration guide or the usage instructions for cmake_modules.

edit flag offensive delete link more


Thanks for your suggestion. I have solved this problem by running g++ -std=c++0x -I /usr/local/include/eigen3 myprogram.cpp -o myprogram

ZYS gravatar image ZYS  ( 2016-02-05 12:02:25 -0600 )edit

Question Tools

1 follower


Asked: 2016-02-01 09:21:28 -0600

Seen: 1,030 times

Last updated: Feb 01 '16