ROS 编译出错 error: ‘shared_ptr’ in namespace ‘std’ does not name a template type

时间:2024-03-24 10:29:47

编译出错:

/opt/ros/kinetic/include/moveit/macros/declare_ptr.h:52:16: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type

ROS 编译出错 error: ‘shared_ptr’ in namespace ‘std’ does not name a template type

解决方法:

取消CMakeLists.txt下 add_compoile_options( -std=c++11 ) 的注释
ROS 编译出错 error: ‘shared_ptr’ in namespace ‘std’ does not name a template type

原因:

ROS都是按照c++03的编译方法进行,如果使用了新标准c++11,则需要先这么处理一下,告知用c++11的方式进行编译。

参考:

https://blog.csdn.net/gyzgyz1989/article/details/53207192
https://answers.ros.org/question/216842/ros-using-c-11-how-to-use-with-catkin/