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

catkin build error

asked 2019-08-22 14:24:11 -0600

impaidk gravatar image

updated 2019-08-24 06:46:29 -0600

gvdhoorn gravatar image

I Downloaded Phantomx_gazebo Package from github and then cloned Phantomx_Description from Github. The page says i need to have Hector_gazebo in my workspace to use the above package. I cloned this as well in my workspace.

After this I used Catkin Build then it gave me some plugin missing error which I the solved by installing the Plugin.

Now after this when I tried to Build the workspace again I get the following error which i have uploaded on gist.

This is the link for the gist Example error:

Errors     << combined_robot_hw:make /home/paidevikiran/wzl_ws/logs/combined_robot_hw/build.make.005.log                                                                                                          
In file included from /home/paidevikiran/wzl_ws/src/ros_control/combined_robot_hw/include/combined_robot_hw/combined_robot_hw.h:37:0,
                 from /home/paidevikiran/wzl_ws/src/ros_control/combined_robot_hw/src/combined_robot_hw.cpp:29:
/home/paidevikiran/wzl_ws/src/ros_control/hardware_interface/include/hardware_interface/robot_hw.h:168:14: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
 typedef std::shared_ptr<RobotHW> RobotHWSharedPtr;
In file included from /home/paidevikiran/wzl_ws/src/ros_control/combined_robot_hw/src/combined_robot_hw.cpp:29:0:
/home/paidevikiran/wzl_ws/src/ros_control/combined_robot_hw/include/combined_robot_hw/combined_robot_hw.h:107:15: error: ‘RobotHWSharedPtr’ is not a member of ‘hardware_interface’
   std::vector<hardware_interface::RobotHWSharedPtr> robot_hw_list_;
/home/paidevikiran/wzl_ws/src/ros_control/combined_robot_hw/include/combined_robot_hw/combined_robot_hw.h:107:15: error: ‘RobotHWSharedPtr’ is not a member of ‘hardware_interface’
/home/paidevikiran/wzl_ws/src/ros_control/combined_robot_hw/include/combined_robot_hw/combined_robot_hw.h:107:51: error: template argument 1 is invalid
   std::vector<hardware_interface::RobotHWSharedPtr> robot_hw_list_;
/home/paidevikiran/wzl_ws/src/ros_control/combined_robot_hw/include/combined_robot_hw/combined_robot_hw.h:107:51: error: template argument 2 is invalid
/home/paidevikiran/wzl_ws/src/ros_control/combined_robot_hw/include/combined_robot_hw/combined_robot_hw.h:116:49: error: ‘hardware_interface::RobotHWSharedPtr’ has not been declared
                             hardware_interface::RobotHWSharedPtr robot_hw);

My System specs are:

  • Ubuntu 16.04
  • Ros-kinetic built from source
  • cmake version 3.5.1
  • gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11)
edit retag flag offensive close merge delete


From your link I understand that you are running on Kinetic. However the "combined_robot_hw" you are using uses std's smart pointers and, AFAIK, before Melodic most of ROS packages used smart pointers from Boost. It might be that you cloned some repositories that are meant for Melodic and some that are meant for Kinetic (that could just explain why they do not work "out of the box"). When you get an error like you should make sure that you are compiling with C++11 (add add_definitions(-std=c++11) into your CMakeLists.txt). You might also need to add #include<memory> in the file(s) that use std::shared_ptr. I would also suggest you to include the link to the repositories you mention (including which branch you cloned) so that it will be easier to provide help!</memory>

ffusco gravatar image ffusco  ( 2019-08-23 09:56:01 -0600 )edit

Hi, This is the link to the repository and the branch that I cloned is kinetic devel. #include <memory> is already there in those files but I'm not able to understand where to add add_definitions(-std=c++11) in the CMakeLists.txt file. (I'm really very new to ROS) Could you help me with this?</memory>

impaidk gravatar image impaidk  ( 2019-08-27 05:11:00 -0600 )edit

Just to check: your link points to the branch melodic-devel, which uses std::shared_ptr(see ). Instead, the kinetic-devel branch uses boost::shared_ptr(see ). Can you check that you cloned the correct branch?

ffusco gravatar image ffusco  ( 2019-09-03 06:43:47 -0600 )edit

Also, to answer your other question: in general you can put add_definitions right after the cmake_minimum_required and project commands in the CMakeLists.txt file. However, I suggest to change it only if really required, ROS control is a very well established package and I am pretty sure you can compile it without changing anything ;)

ffusco gravatar image ffusco  ( 2019-09-03 06:47:24 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2019-08-26 07:29:57 -0600

prefpkg21 gravatar image

updated 2019-08-26 07:30:41 -0600

did you see if there are missing dependencies?

from catkin_ws/ run rosdep install --from-paths src --ignore-src -r -y

this parses the package.xml files of those in your workspace and installs them for you if they are missing.

edit flag offensive delete link more


I tried doing this but even though it updated some dependencies I'm having the same error.

impaidk gravatar image impaidk  ( 2019-08-27 04:42:34 -0600 )edit

Can you post your CMakeLists file?

prefpkg21 gravatar image prefpkg21  ( 2019-08-27 10:52:05 -0600 )edit

Question Tools

1 follower


Asked: 2019-08-22 14:24:11 -0600

Seen: 2,264 times

Last updated: Aug 26 '19