【问题标题】:Ambiguous Symbol string with protobuf带有 protobuf 的模棱两可的符号字符串
【发布时间】:2013-12-08 18:05:43
【问题描述】:

同时包含 protobuf 2.5 和 irrlicht 3d 引擎后,我收到以下编译错误:

...\irrlicht\trunk\source\protobuf-2.5.0rc1\src\google\protobuf\generated_message_util.h(71):
error C2872: 'string' : ambiguous symbol 
could be 'c:\msdev2010\vc\include\xstring(2062) : std::basic_string<_Elem,_Traits,_Ax> 
std::string' 
with 
[ 
    _Elem=char, 
    _Traits=std::char_traits<char>, 
    _Ax=std::allocator<char> 
] 
or
c:\projects\ultimatestrategy\irrlicht\include\irrstring.h(74) : irr::core::string

现在我意识到 protobuf 导致了问题,因为它们不使用完整的符号名称,而是使用指令 using

问题:解决其中一个或两个库以使它们一起运行良好的最快方法是什么?

注意:我在这个问题上找到的唯一参考:https://code.google.com/p/protobuf/issues/detail?id=544&q=ambiguous%20symbol&colspec=ID%20Type%20Status%20Priority%20FixedIn%20Owner%20Summary

任何帮助将不胜感激。

【问题讨论】:

  • 你能试试把'package irr;'作为 proto 文件的第一行并重新生成?
  • 很遗憾没有。 package在.proto定义文件中只能使用一次。

标签: c++ protocol-buffers irrlicht


【解决方案1】:

我最终将所有 string 替换为 std::string 在谷歌的代码中。 我还用 std::map 替换了所有 ma​​p

不幸的是,每次更新 protobuf 库时都需要这样做,而且非常不切实际。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-17
    • 1970-01-01
    • 1970-01-01
    • 2016-06-05
    • 1970-01-01
    相关资源
    最近更新 更多