protobuf:使用的是(protobuf-2.6.1),这个带有vs工程。
windows下,需要下载两个包:
protobuf-2.6.1.tar.bz2 (protobuf所有的源码都在里面,用它进行编译成lib库)
去官网下载protobuf比较慢
github地址
https://github.com/protocolbuffers/protobuf/releases/tag/v2.6.1
二.配置环境:
1.进入 D:protobuf-2.6.1vsprojects,用vs运行protobuf.sln,然后build solution。
2.D:protobuf-2.6.1examples是有例子的,在此目录下定义一个proto:
package tutorial;
message Person {
required string name = 1;
required int32 age = 2;
optional string email = 3;
}
然后使用cmd运行protoc.exe生成我们的目标语言格式(c++).
cd D:protobuf-2.6.1vsprojectsDebug
D:protobuf-2.6.1vsprojectsDebug>protoc -I=D:protobuf-2.6.1examples --cpp_out=D:protobuf-2.6.1examples D:protobuf-2.6.1examplesperson.proto
生成了person.pb.h和person.pb.cc的文件。
最后
以上就是虚拟星月最近收集整理的关于google protobuf windows下环境配置的全部内容,更多相关google内容请搜索靠谱客的其他文章。
发表评论 取消回复