学习运用google protobuf 使用
下载源码https://github.com/google/protobuf
如果是直接git的源码 按照src README.md 要求执行 ./autogen.sh 报错:autoreconf: /usr/bin/autoconf failed with exit status: 1
我的系统是centos 6 执行 yum install libtool 后 再执行 ./autogen.sh 成功
执行make 在执行make 指令出现 在文件从./google/protobuf/any.pb.h:25包括,
从谷歌/的protobuf / any.pb.cc:5:
./google/protobuf/metadata.h:在构造'谷歌:: protobuf的::内部:: InternalMetadataWithArena :: InternalMetadataWithArena(谷歌:: protobuf的竞技场:: *)':
./google/protobuf/metadata.h:175:错误:类'谷歌:: protobuf的内部:: :: InternalMetadataWithArena“没有任何名为“InternalMetadataWithArenaBase”字段
./google/protobuf/metadata.h:在构造'谷歌:: protobuf的内部:: :: InternalMetadataWithArenaLite :: InternalMetadataWithArenaLite(谷歌:: protobuf的竞技场:: *)':
./google/protobuf/metadata .H:204:错误:类'谷歌:: protobuf的内部:: :: InternalMetadataWithArenaLite'没有名为任何领域“InternalMetadataWithArenaBase'
让[2]:*** [谷歌/的protobuf / any.pb.lo]错误1
使[2]:离开目录/home/protobuf/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory
的/ home / protobuf的'
使:*** [全部]错误2
解决方案 :
public:
173 InternalMetadataWithArena() {}
174 explicit InternalMetadataWithArena(Arena* arena)
175 // : InternalMetadataWithArenaBase(arena) {}
176 : InternalMetadataWithArenaBase<UnknownFieldSet,InternalMetadataWithArena>(arena) {}
public:
202 InternalMetadataWithArenaLite() {}
203
204 explicit InternalMetadataWithArenaLite(Arena* arena)
205 // : InternalMetadataWithArenaBase(arena) {}
206 : InternalMetadataWithArenaBase<string,InternalMetadataWithArenaLite>(arena) {}
然后在执行make successs