|
Foreword
Recently the need to use Google Protocol Buffer out to do some of the services communicate with each other, since the Protocol Buffer no native support for C, use only protobuf-c of this third-party libraries, with the Internet nor the complete installation, it recorded.
What Protocol Buffer that?
Protocol Buffer is a language-independent, platform-independent, scalable, and for serializing structured data communication protocol method, the stored data. Like XML, but it is smaller, faster and easier. You can define your own data structure, and then use the code generator generates code to read and write this data structure.
Installation protobuf
Since protobuf-c is not yet supported by the latest version of protobuf 2.4.1, so we need to install a supported version 2.3.0. Installation steps are as follows:
wget http://protobuf.googlecode.com/files/protobuf-2.3.0.tar.gz
tar zxvf protobuf-2.3.0.tar.gz
cd protobuf-2.4.1
./configure --prefix = / usr /
make
sudo make install
/ Sbin / ldconfig -v
The last command is particularly important, do not forget, time or install protobuf-c will be reported to the shared library path error
Installation protobuf-c
Follow the steps below to install protobuf-c's.
wget http://protobuf-c.googlecode.com/files/protobuf-c-0.15.tar.gz
tar zxvf protobuf-c-0.15.tar.gz
cd protobuf-c-0.15
./configure --prefix = / usr /
make
sudo make install
Test protobuf-c
Run the following command, no error is generated to view the next file.
cd ..
protoc-c --c_out =. / protobuf-c-0.15 / src / test / test.proto |
|
|
|