Protocol Buffers在windwos下生成对应语言类文件

1:windows下开发,下载源码包和windows下的编译器java

https://developers.google.com/protocol-buffers/docs/downloadspython

下载 Protocol Buffers 2.6.1 full source和 Protocol Compiler 2.6.1 binary for windowsc++


2:解压源码包和windows下编译器包,个人路径:F:\protobuf-2.6.1   和   F:\protoc-2.6.1-win32windows


3:把编译器包下解压出来的protoc.exe文件拷贝到C:\Windows\System32目录下,同时拷贝一份到F:\protobuf-2.6.1\src目录下google


4:CMD下,protoc --version,显示:libprotoc 2.6.1spa


5:F:\protobuf-2.6.1\examples目录下addressbook.proto文件code


6:CMD到F:\protobuf-2.6.1,执行:教程

protoc --proto_path=examples --java_out=examples/javacode examples/addressbook.proto

而后能够看到F:\protobuf-2.6.1\examples\javacode目录下java源文件已经生成,带java package目录
开发


7:接着6的CMD路径下,生成对应的C++和python文件get

C++     【protoc --proto_path=examples --cpp_out=examples/c++code examples/addressbook.proto】
python  【protoc --proto_path=examples --python_out=examples/pythoncode examples/addressbook.proto】


Protocol Buffers:

开发者地址: https://developers.google.com/protocol-buffers/ 

安装包下载:https://developers.google.com/protocol-buffers/docs/downloads

各语言教程:https://developers.google.com/protocol-buffers/docs/tutorials  主要是Java,C++,Python

相关文章
相关标签/搜索