在Ubuntu安装protobuf(C++)

原文链接:https://blog.csdn.net/qq_41950508/article/details/127126215

一、protobuf的下载和解压

protobuf提供了一些发布的版本,可以从里面下载指定语言的压缩包。

例如:

wget https://github.com/protocolbuffers/protobuf/releases/download/v21.7/protobuf-cpp-3.21.7.zip
unzip protobuf-cpp-3.21.7.zip

二、protobuf的安装
在上面解压的文件夹下,是有一个README.md文件的,里面介绍了安装的方式,主要是:

To build protobuf from source, the following tools are needed:

autoconf
automake
libtool
make
g++
unzip
On Ubuntu/Debian, you can install them with:
 

sudo apt-get install autoconf automake libtool curl make g++ unzip

To build and install the C++ Protocol Buffer runtime and the Protocol

Buffer compiler (protoc) execute the following:

./configure

make -j$(nproc) # $(nproc) ensures it uses all cores for compilation

make check

sudo make install

sudo ldconfig # refresh shared library cache.

By default, the package will be installed to /usr/local.

可以在终端上输入protoc --version查看安装成功与否

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值