Sword protobuf学习一

protobuf简介
    Protocol Buffers,是Google公司开发的一种数据描述语言,类似于XML能够将结构化数据序列化,可用于数据存储、通信协议等方面。
它不依赖于语言和平台并且可扩展性极强。现阶段官方支持C++、JAVA、Python三种编程语言,但可以找到大量的几乎涵盖所有语言的第三方拓展包。
#protobuf编译流程

1.确定centos7上已经安装了下面的软件,或者直接用yum进行更新
autoconf
automake
libtool
curl (used to download gmock)
make
g++
unzip

2.下载源码包,解压,编译安装
地址:https://github.com/google/protobuf/releases
选择Source code (tar.gz)下载
>>tar -zxvf protobuf-3.1.0.tar.gz -C /usr/local/
>>cd protobuf-3.1.0/
>>./autogen.sh
# 指定安装路径
>>./configure --prefix=/usr/local/protobuf
#编译
>>make
# 测试,这一步很耗时间--不执行测试也无所谓
>>make check 
>>make install

3.编写proto文件

4.执行build.sh脚本,生成相关c文件

5.业务逻辑编写

猜你喜欢

转载自www.cnblogs.com/zhanggaofeng/p/9689520.html