【问题标题】:Strange Xcode linker warning building Poco C++ app奇怪的 Xcode 链接器警告构建 Poco C++ 应用程序
【发布时间】:2015-06-05 01:02:07
【问题描述】:

在使用 Xcode 6 构建适用于 iOS 的 Poco C++ 应用程序时,其他人是否看到过这些链接器警告?

ld: warning: direct access in std::__1::vector<Poco::Dynamic::Var, std::__1::allocator<Poco::Dynamic::Var> > const& Poco::Dynamic::Var::extract<std::__1::vector<Poco::Dynamic::Var, std::__1::allocator<Poco::Dynamic::Var> > >() const to global weak symbol typeinfo for std::__1::vector<Poco::Dynamic::Var, std::__1::allocator<Poco::Dynamic::Var> > means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in std::__1::vector<Poco::Dynamic::Var, std::__1::allocator<Poco::Dynamic::Var> > const& Poco::Dynamic::Var::extract<std::__1::vector<Poco::Dynamic::Var, std::__1::allocator<Poco::Dynamic::Var> > >() const to global weak symbol typeinfo for std::__1::vector<Poco::Dynamic::Var, std::__1::allocator<Poco::Dynamic::Var> > means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in std::__1::vector<Poco::Dynamic::Var, std::__1::allocator<Poco::Dynamic::Var> > const& Poco::Dynamic::Var::extract<std::__1::vector<Poco::Dynamic::Var, std::__1::allocator<Poco::Dynamic::Var> > >() const to global weak symbol typeinfo for std::__1::vector<Poco::Dynamic::Var, std::__1::allocator<Poco::Dynamic::Var> > means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in std::__1::vector<Poco::Dynamic::Var, std::__1::allocator<Poco::Dynamic::Var> > const& Poco::Dynamic::Var::extract<std::__1::vector<Poco::Dynamic::Var, std::__1::allocator<Poco::Dynamic::Var> > >() const to global weak symbol typeinfo for std::__1::vector<Poco::Dynamic::Var, std::__1::allocator<Poco::Dynamic::Var> > means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.

如果是这样,您是否确定了它们的原因以及如何解决它们?

编辑:基于此主题的其他线程,我已验证所有项目(包括 Poco)的“默认隐藏符号”设置为 YES。

谢谢。

【问题讨论】:

  • 这是错误还是警告?

标签: c++ ios xcode poco-libraries


【解决方案1】:

在我的带有多个静态库的 iOS 项目中,有大量此类警告 - 所有关于对全局弱符号类型信息的引用。

终于找到了解决办法:

不要将“默认隐藏的符号”设置为“是”。将其设置为默认值 - 在“构建设置”中选择相关行,点击删除。在这里,对于我的主要 iOS 可执行文件,它似乎解析为“是”,而对于静态库,它似乎解析为“否”。

这样做后,所有关于直接访问全局弱符号的警告都消失了,我的整个项目似乎工作正常。

我希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-11
    • 1970-01-01
    • 2017-12-09
    • 1970-01-01
    • 2016-06-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多