现在的位置: 首页 > 综合 > 正文

protobuf-objc 2.2.0 在mac 10.9上编译不通过

2014年10月22日 ⁄ 综合 ⁄ 共 1046字 ⁄ 字号 评论关闭

升级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

抱歉!评论已关闭.