protobuf编译出错的解决方案(iOS,OSX)

protobuf

最近使用protobuf,变编译工具时遇上一点问题.现在附上解决方案

编译过程

完全参照

https://github.com/alexeyxo/protobuf-objc

编译出错

遇到如下错误

./google/protobuf/objectivec-descriptor.pb.h:17:2: error: This file was
generated by an older version of protoc which is
#error This file was generated by an older version of protoc which is
^
./google/protobuf/objectivec-descriptor.pb.h:18:2: error: incompatible with your
Protocol Buffer headers. Please
#error incompatible with your Protocol Buffer headers. Please
^
./google/protobuf/objectivec-descriptor.pb.h:19:2: error: regenerate this file
with a newer version of protoc.
#error regenerate this file with a newer version of proton.

解决方案

根据文档中

ln -s /usr/local/Cellar/protobuf/2.6.1/bin/protoc /usr/local/bin

作者应该使用2.6.1编译的,我将brew中的protobuf降级到了2.6.0(现在安装是3.1.0).

结果可以顺利编译

另外附上降级指南http://sanwen8.cn/p/5a9lM4E.html

上一篇:ER-Studio的五种关系说明


下一篇:Linux统计系统文件类型出现的次数