windows下Google Protocol Buffer 编译安装教程
来源:互联网 发布:中兴 南京 云计算部门 编辑:程序博客网 时间:2024/05/29 13:25
protobuf的全称是Protocol Buffer,它是google 的一种数据交换的格式,可用于用于分布式应用之间的数据通信或者异构环境下的数据交换,
最近因为项目的需求,需要接触Protobuf,在官方提供的压缩包中,提供了Linux下的编译脚本,但是,由于项目在windows下开发,因此,需要在Windows编译和安装Protobuf,结合自己的探索,希望能够帮助到初次接触到protobuf的朋友
1.下载Google Protocol Buffer源码包
下载可以到protobuf官网下载:http://code.google.com/p/protobuf/downloads/list,一般下载第一个或是第二个,因为第一,二个是源码包,第三个是可执行文件
2.解压压缩包
解压压缩包后,会得到类似于下面的文件列表:
3.编译vs工程
- 在解压后的文件夹中,打开vsprojects目录,目录中的文件如图所示:
打开libprotobuf.vcproj(这个是vs的工程文件,打开前请确认安装了vs2005 或vs2008,vs2010等等),在打开工程中, 可能需要转换工程,直接转换就行了
打开后,vs的工程页面如图所示:
右键分别生成libprotobuf,libprotobuf-lite,libprotoc,protoc这四个工程(编译模式为Release 模式):
4.编译完成
编译完成后,可以在vsprojects\Release下发现3个lib和一个exe文件,他们分别是libprotobuf.lib,libprotobuf-lite.lib,libprotoc.lib和protoc.exe :
5.拷贝文件到windows目录下:
将得到的libprotobuf.lib,libprotobuf-lite.lib,libprotoc.lib和protoc.exe拷贝到系统盘的windows目录下。如果你的系统安装在C盘,那么就拷贝到c:\windows目录下
6.编译proto文件,生成c++文件
假设在E:\test目录下有一个名为addressbook.proto的proto文件,那么打开CMD,输入下面的命令就可以生成C++源码了:
protoc.exe -I=e:\
test
--cpp_out=e:\
test
e:\
test
\addressbook.proto
生成了addressbook.pb.h和addressbook.pb.cc文件,将这个文件拷贝到需要用到的工程里就可以直接用了:
至此,protobuf的编译和使用教程就这么多了,如果有错误的地方,还请多多指出
转载请注明来自蒲公英博客@Kuaile.IN,本文地址:http://kuaile.in/archives/1214除非注明,蒲公英博客文章均为原创,转载请注明出处和链接!
- windows下Google Protocol Buffer 编译安装教程
- windows下Google Protocol Buffer 编译安装教程
- windows下Google Protocol Buffer 编译安装教程
- windows下Google Protocol Buffer 编译安装(vs)教程
- windows下Google Protocol Buffer 编译安装教程
- windows下Google Protocol Buffer 编译安装(vs)教程
- windows以及linux 环境下Google Protocol Buffer 下载编译安装教程
- Android NDK下编译google protocol buffer
- Google Protocol Buffer安装编译及使用
- google protocol buffer 在windows下 编译错误还真是不少啊!
- windows环境下安装protocol buffer
- Android NDK下编译google protocol buffer(protobuf)
- Android NDK下编译google protocol buffer(protobuf)
- Ubuntu安装Google Protocol Buffer
- linux下安装使用protocol buffer编译工具
- windows下使用protocol buffer
- 使用NDK编译Google Protocol Buffer
- Google-Protocol Buffer例子编译问题
- 好厉害的库edge.js!实现C#与node.js互操作
- java 中jdbc 链接数据库
- Myeclipse搭建SSH框架
- ECNU OJ
- Centos 7 安装过程中的一些坑
- windows下Google Protocol Buffer 编译安装教程
- 随机生成15个数,最小的在最下方。。。。。。。
- Android使用procrank和dumpsysmeminfo分析内存占用情况
- 完全二叉树
- *** Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:], /BuildRoot/Library/C
- Mysql 存储引擎中InnoDB与Myisam的主要区别
- 小波工具箱的使用2
- MATLAB全局变量
- 我的第一次作业喔