1) goolge上下載2.4.1,下載地址https://code.google.com/p/protobuf/downloads/list.
2) tar -xzf protobuf-2.4.1.tar.gz 解壓protobuf 到 protubuf-2.4.1.
3) cd protobuf-2.4.1.
4) ./configure —prefix=/usr/local ,不能通過的話,需要設置CPPFLAGS=-DGTEST_USE_OWN_TR1_TUPLE=1.
5) 執行make,如果出現錯誤--google/protobuf/message.cc:130:60: error: implicit instantiation of undefined template 'std::__1::basic_istream<char, std::__1::char_traits<char> >',需要打開message.cc文件(路徑src/google/protobuf/),添加頭文件#include <istream>.
6) 完成之後使用make check檢查
7) 都通過的話,protoc --version就能夠正常顯示protobuf的版本號。