升级mac 10.8到10.9后protobuf-objc编译不成功,报错信息如下:
google/protobuf/message.cc:130:60: error: implicit instantiation of undefined template 'std::__1::basic_istream<char, std::__1::char_traits<char> >'
return ParseFromZeroCopyStream(&zero_copy_input) && input->eof();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iosfwd:108:28: note: template is declared here
class _LIBCPP_TYPE_VIS basic_istream;
^
google/protobuf/message.cc:135:67: error: implicit instantiation of undefined template 'std::__1::basic_istream<char, std::__1::char_traits<char> >'
return ParsePartialFromZeroCopyStream(&zero_copy_input) && input->eof();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iosfwd:108:28: note: template is declared here
class _LIBCPP_TYPE_VIS basic_istream;
在网上查了很久,大概原因是编译器弄错了,在源码message.cc中加上包含如下头文件的声明:
#include <istream>
然后再重新配置和编译就好了。
参考:
http://code.google.com/p/metasyntactic/issues/detail?id=144&q=implicit%20instantiation%20of%20undefined
https://code.google.com/p/protobuf/issues/detail?id=455

本文介绍了在Mac OS从10.8升级到10.9后遇到的protobuf-objc编译错误问题,并提供了解决方案。主要错误在于编译器对模板的隐式实例化失败,通过在源码中加入<iostream>头文件的包含声明即可解决。
210

被折叠的 条评论
为什么被折叠?



