A moment to download 
Google Download Address: Https://developers.google.com/protocol-buffers/docs/downloads?hl=zh-CN 
GitHub Download Address: https://github.com/google/protobuf 
I download version here: protobuf-2.6.1.tar.gz 
 
 
Second compilation 
1 decompression 
Extract the above compressed package into the folder protobuf-2.6.1. 
 
 
2 compiling 
2.1 In protobuf-2.6.1, find Vsprojects/protobuf.sln, double-click with vs to open. 
2.2 Set the compile mode to release mode, then compile Libprotobuf,libprotobuf-lite,libprotoc,protoc (right key-> build). 
 
 
3 Copy Library 
In Vsprojects\release find Libprotobuf.lib,libprotobuf-lite.lib,libprotoc.lib and Protoc.exe, copy to C:\Windows directory. 
 
 
4 Generating header files 
Double-click Extract_includes.bat to generate an include directory under the Vsprojects directory. 
 
 
Three compiler Proto 
1 Create a new Person.proto in the D:/GPB directory and edit the contents as follows: 
 
Package proto;
Message person {
  Required String name = 1;
  Required Int32 id = 2;
  Optional String email = 3;
}
#gpb即Google Protocol Buffer 
 
 
2 generating C + + classes 
In the GPB file, right-click-> to open the command line here, enter: 
Protoc.exe Person.proto--cpp_out=. 
 
 
This generates the person class under the current folder, and the file is as follows: 
 
 
 
Four Proto detailed explanation 
1 Key Words 
The package keyword is to specify a namespace 
Message keyword, similar to struct in C or class in C + + and Java 
 
 
2 Property Description 
Required non-empty fields 
Optional optional fields 
A field represented by repeated can contain 0 or more data. 
 
 
3 types 
 
As shown in figure:
 
 
 
Original link: http://blog.csdn.net/xufeng0991/article/details/45031211