在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查看安装成功与否

你可能感兴趣的:(ubuntu,linux,运维)