Mac installs protobuf and compiles it into Java, C + +, and python
1. Download address: https://code.google.com/p/protobuf/downloads/list
In addition, you can view this link to see more content in Chinese: http://www.cnblogs.com/foxhengxing/archive/2010/08/10/1796165.html
2. See readme before installation txt
3. Confirm that GCC has been installed: enter GCC -- version test under the terminal
4. Terminal switching administrator: sudo su. After entering the password, if you see sh-3.2#, it indicates success.
5. Switch to protobuf under the terminal. cd protobuf-2.5. 0
6. Input at the terminal/ configure。 Note: or enter:/ configure - -prefix=$INSTALL_ DIR
7. Input
$ make $ make check $ make install
Enter protocol -- version to check whether the installation is successful.
8. Add to path:/ configure --prefix=/usr
9. Through the above steps, you can basically do it. If not, you can continue to do readme Txt other steps, there are tutorials in them, but they are in English.
10. Compile the code and put MSG Proto is placed in protobuf-2.5 0, CD protobuf-2.5 0:
(1) . compile as Java: protocol -- java_out =. / examples. / examples / msg.proto
(2) . compile into C + +: protocol -- cpp_out =. / examples. / examples / msg.proto
(3) . compile as Python: protocol -- python_out =. / examples. / examples / msg.proto
11. Attach MSG Proto file:
other:
1. The official examples can be found in the examples folder.
2. See the official example: https://developers.google.com/protocol-buffers/docs/javatutorial
Small examples on the official website, such as generating a person object
3. Link to this article: http://www.cnblogs.com/liqw/p/3696309.html
4. Protobuf Chinese Translation: http://wenku.baidu.com/view/301f260e90c69ec3d5bb75ab.html