版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/flyfish1986/article/details/85103865
ROS 编译代码过程中遇到的Protocol Buffer版本问题
flyfish
版本 Ubuntu16.04 , Kinetic,Gazebo7
现象
现象
/usr/include/gazebo-7/gazebo/msgs/color.pb.h:17:2: error: #error This file was generated by an older version of protoc which is
#error This file was generated by an older version of protoc which is
^
/usr/include/gazebo-7/gazebo/msgs/color.pb.h:18:2: error: #error incompatible with your Protocol Buffer headers. Please
#error incompatible with your Protocol Buffer headers. Please
^
/usr/include/gazebo-7/gazebo/msgs/color.pb.h:19:2: error: #error regenerate this file with a newer version of protoc.
#error regenerate this file with a newer version of protoc.
In file included from /usr/include/gazebo-7/gazebo/msgs/MessageTypes.hh:100:0,
from /usr/include/gazebo-7/gazebo/msgs/msgs.hh:32,
from /usr/include/gazebo-7/gazebo/physics/Entity.hh:30,
from /usr/include/gazebo-7/gazebo/physics/Model.hh:34,
from /usr/include/gazebo-7/gazebo/physics/Actor.hh:24,
from /usr/include/gazebo-7/gazebo/physics/physics.hh:2,
from /opt/ros/kinetic/include/gazebo_ros_control/robot_hw_sim.h:45,
from /home/pumpkinking/catkin_ws/src/chapter7_tutorials/rosbook_arm_hardware_gazebo/include/rosbook_arm_hardware_gazebo/rosbook_arm_hardware_gazebo.h:15,
from /home/pumpkinking/catkin_ws/src/chapter7_tutorials/rosbook_arm_hardware_gazebo/src/rosbook_arm_hardware_gazebo.cpp:11:
/usr/include/gazebo-7/gazebo/msgs/shadows.pb.h:267:113: error: expected class-name before ‘{’ token
gazebo::msgs::Shadows_ShadowType> : ::google::protobuf::internal::true_type {};
查找原因
查看/usr/include/gazebo-7/gazebo/msgs其中一个文件说明
#if GOOGLE_PROTOBUF_VERSION < 2006000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
#if 2006001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
#endif
Protocol Buffer 需要2.6.1版本
下载2.6.1版本后执行
./configure
make
make check
sudo make install
再次执行catkin_make