当前位置:网站首页>安装和使用protobuf-c
安装和使用protobuf-c
2022-06-22 12:48:00 【wwwlyj123321】
protobuf支持一些主流的语言,唯独没有支持C。所以诞生了第三方的protobuf-c。
https://github.com/protocolbuffers/protobuf
https://github.com/protobuf-c/protobuf-c在安装 protobuf-c 之前需要安装 protobuf
1、安装protobuf
安装protobuf需要依赖一些工具,需要先安装依赖:
sudo apt-get install autoconf automake libtool curl make g++ unzip安装完依赖后一依次输入如下命令下载、编译、安装(下载速度慢的话可以先导入码云再下载)
git clone https://github.com/protocolbuffers/protobuf.git
cd protobuf
./autogen.sh
./configure
make
sudo make install
sudo ldconfig其中,执行./autogen.sh命令为了生成configure配置脚本,执行configure可生成Makefile文件,执行make进行编译,执行sudo make install命令进行安装,执行sudo ldconfig命令让动态链接库为系统所共享。
2、安装protobuf-c
同样的,protobuf-c也要依赖于 pkg-config ,输入以下命令进行安装:
sudo apt-get install pkg-config然后输入如下命令下载、编译、安装protobuf-c:
git clone https://github.com/protobuf-c/protobuf-c.git
cd protobuf-c
./autogen.sh
./configure
make
sudo make install
按以上方式安装的话,protobuf与protobuf-c默认安装在/usr/local路径下:
查看版本:


生成的.h头文件中有如下校验:
ref:
边栏推荐
猜你喜欢
随机推荐
史蒂芬·柯维写给年轻人的高效工作秘笈
定金预售的规则思路详解
SQL Server common functions
leetcode-子序列/子串問題
Oracle user space statistics
天润云上市在即:VC大佬田溯宁大幅减持,预计将套现2.6亿港元
What does Huawei's minutes on patents say? (including Huawei's top ten inventions)
在CSDN写文几年,我出了“第一本书“,感恩!
SQL row column conversion
Redis+Caffeine两级缓存的实现
LDA study notes
Leetcode union search set
融云:让银行轻松上“云”
《Kubernetes监控篇:Grafana通过自动化方式添加datasource和dashboard》
Performance related indicators
Oracle stored procedure 2
leetcode-数学题
leetcode 968. Monitoring binary tree
Screenshot of the uniapp app and save it locally
Summary of patent blog writing







