installation
gmock can not download due to the GFW, so I manunally download it from browser throuth vpn with the help from the script file autogen.sh.
from the file autogen.sh, we can get that:
- the url of downloading gmock: https://googlemock.googlecode.com/files/gmock-1.7.0.zip
- make it right for the next installation which is unzip the package and rename it to gmock and mv it to the current directory as the autogen.sh located:
unzip -q gmock-1.7.0.zip rm gmock-1.7.0.zip mv gmock-1.7.0 gmock
then, rollow the installation tips from protocol buffers on github, installation is done.
read the doc
read the example code and the tutorial Protocol Buffer Basics: C++ to know how to use it
all code represent in the tutotial are exist in the example folder, so what I need to do is make clear that the steps to run and use protocol buffers , as the tutorial writing:
1. If you haven't installed the compiler, download the package and follow the instructions in the README.
2. Now run the compiler, specifying the source directory (where your application's source code lives – the current directory is used if you don't provide a value), the destination directory (where you want the generated code to go; often the same as $SRC_DIR), and the path to your .proto. In this case, you...:
protoc -I=$SRC_DIR --cpp_out=$DST_DIR $SRC_DIR/addressbook.proto
Because you want C++ classes, you use the --cpp_out option – similar options are provided for other supported languages.
This generates the following files in your specified destination directory:
* addressbook.pb.h, the header which declares your generated classes.
* addressbook.pb.cc, which contains the implementation of your classes.
Step one is ok with me, and the step two doesn’t make me feel puzzle, and the code from the example is finished, read thes code is not a tough thing to me, what’s more I can review a liite cpp and shell script tips,I absorted something.