Operating System: Ubuntu 14.04 c++
Language: C++ shell
1. Refer to the official guided documentations for the Installation of Protocol Buffer: app
Overview: https://developers.google.com/protocol-buffers/docs/overview ide
Downloads: https://developers.google.com/protocol-buffers/docs/downloads ui
Protocol Buffer for C++: https://developers.google.com/protocol-buffers/docs/cpptutorial google
* It is worth noting that read the README.md file before installing Protocol Buffer. spa
2. If error appears after using the "make" command as follows, follow the steps given below. c++11
Error Information: code
protoc: error while loading shared libraries: libprotobuf.so.9: cannot open shared object file: No such file or directory orm
protoc: error while loading shared libraries: libprotoc.so.9: cannot open shared object file: No such file or directory
Solution:
make a hard link:
#cd /usr/lib #sudo ln -s /usr/local/lib/libprotobuf.so.9 libprotobuf.so.9 #sudo ln -s /usr/local/lib/libprotoc.so.9 libprotoc.so.9
#g++ -I /usr/local/include/google/protobuf -L /usr/local/lib main.cpp addressbook.pb.cc -lprotobuf -pthread
* In addition, if we are using C++ 11, add -std=c++11 to the sentence:
#g++ -I /usr/local/include/google/protobuf -L /usr/local/lib main.cpp addressbook.pb.cc -lprotobuf -pthread -std=c++11
References: http://stackoverflow.com/questions/10404027/cant-compile-example-from-google-protocol-buffers