我正在尝试根据PX4 的说明编译PX4提供的凉亭示例。我正在开发 Ubuntu-18.04。
运行 command:make px4_sitl gazebo
时,出现以下错误:
...
In file included from Range.pb.h:27:0,
from Range.pb.cc:5:
/usr/include/gazebo-9/gazebo/msgs/quaternion.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
#error This file was generated by a newer version of protoc which is
^~~~~
/usr/include/gazebo-9/gazebo/msgs/quaternion.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
#error incompatible with your Protocol Buffer headers. Please update
^~~~~
/usr/include/gazebo-9/gazebo/msgs/quaternion.pb.h:14:2: error: #error your headers.
#error your headers.
^~~~~
...
将错误消息拼凑在一起给出:此文件是由与您的协议缓冲区标头不兼容的较新版本的 protoc 生成的。请更新您的标题。
我的机器上有两个不同的protoc
二进制文件:
/usr/bin/protoc
(3.0.0),所需的最低版本~/catkin_ws/devel/bin/protoc
(2.6.0),太老了,默认使用
如何确保使用第一个版本?我试过这个:export PATH=/usr/bin:$PATH
以确保首先找到正确的编译器,但我可能还需要指示使用正确的头文件,因此在/usr/include/google/protobuf
而不是~/catkin_ws/devel/include/google/protobuf
. 但是,我不确定如何进行。