当前位置:网站首页>Installing and using protobuf-c

Installing and using protobuf-c

2022-06-22 14:02:00 wwwlyj123321

protobuf Support some mainstream languages , There is no support C. So the birth of a third party protobuf-c.

https://github.com/protocolbuffers/protobuf
https://github.com/protobuf-c/protobuf-c

In the installation protobuf-c It needs to be installed before protobuf

1、 install protobuf


install protobuf Need to rely on some tools , Dependency needs to be installed first :

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

After installing the dependency, enter the following commands to download 、 compile 、 install ( If the download speed is slow, you can import the code cloud before downloading )

git clone https://github.com/protocolbuffers/protobuf.git
cd protobuf
./autogen.sh
./configure
make
sudo make install
sudo ldconfig

among , perform ./autogen.sh Command to generate configure The configuration script , perform configure Generative Makefile file , perform make Compile , perform sudo make install Command to install , perform sudo ldconfig Command to make the dynamic link library shared by the system .
 

2、 install protobuf-c

alike ,protobuf-c Also rely on pkg-config , Enter the following command to install :

sudo apt-get install pkg-config

Then enter the following command to download 、 compile 、 install protobuf-c:

git clone https://github.com/protobuf-c/protobuf-c.git
cd protobuf-c
./autogen.sh
./configure
make
sudo make install


If installed as above ,protobuf And protobuf-c Default installed in /usr/local Under the path :
 

View version :

 

  Generated .h The header file contains the following verifications :

 

ref:

原网站

版权声明
本文为[wwwlyj123321]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206221247483148.html