protobuf 版本问题
This file was generated by an older version of protoc which is incompatible with your Protocol Buffer headers. Pleaseregenerate this file with a newer version of protoc.which protoc 可以查看默认选用protoc的路径
protoc --version 可以查看当前protoc版本
删除旧版本
cd /usr/local/ (使用which protoc查询protobuf路径)
rm -rf protobuf
查看linux版本 cat /etc/redhat-release
protobuf下载地址:https://github.com/protocolbuffers/protobuf/releases
下载自己需要的版本
下载:wget https://github.com/protocolbuffers/protobuf/releases/download/v3.13.0/protobuf-all-3.13.0.tar.gz
解压:tar -zxvf protobuf-all-3.20.0.tar.gz
安装:cd protobuf-3.20.0
./configure --prefix=/usr/local/protobuf
make
make install
配置环境变量:
vi /etc/profile
加一行:export PKG_CONFIG_PATH=/usr/local/protobuf/lib/pkgconfig/
保存profile退出
检查版本是否生效:
source /etc/profile
protoc --version
页:
[1]