xcode with boost : linker(Id) 关于可见性设置的警告
我一直在为我的 iPhone Xcode 项目使用下面链接中的 boost 框架: https://goodliffe.blogspot.com/2010 /09/building-boost-framework-for-ios-iphone.html
它工作正常,但我总是收到数百个 Apple Mach-O Linker(id) 警告,例如:
在 __ZN5boost15program_options6detail7cmdline24handle_additional_parserERSt6vectorISsSaISsEE 中直接访问全局弱符号 __ZTVN5boost17bad_function_callE 意味着弱符号无法在运行时被覆盖。这可能是由于使用不同的可见性设置编译不同的翻译单元所致。
如何消除代码中的这些警告?
编辑: 通过设置默认隐藏的符号 = YES,我设法摆脱了大部分警告,但还有 3 个警告不会消失,谁能告诉我为什么?
再次编辑: 重建后剩余的 3 个警告也消失了!所以我的解决方案确实有效!
I have been using a boost framework from the link below for my iPhone Xcode project:
https://goodliffe.blogspot.com/2010/09/building-boost-framework-for-ios-iphone.html
it works fine but I always get hundreds of Apple Mach-O Linker(id) Warnings like:
Direct access in __ZN5boost15program_options6detail7cmdline24handle_additional_parserERSt6vectorISsSaISsEE to global weak symbol __ZTVN5boost17bad_function_callE means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
How to get rid of those warnings in code?
edited:
By set Symbols Hidden by Default = YES, I managed to get rid of most of the warnings but there are 3 more left which won't go away, can anyone tell me why?
edited again:
After a rebuild the remaining 3 warning are gone as well! So my solution did work!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我也遇到了这个问题。
事实证明,我不小心做了这样的事情:
我通过更改为解决了这个问题:
I also had this problem.
It turns out that I was carelessly doing something like this:
Which I solved by changing to:
如果 boost 被多个项目包含,则每个项目必须具有相同的值
If boost is included by multiple projects, each project must have the same values for
Doe 只是想出了如何消除数百个这样的警告:
为整个目标或项目设置默认隐藏符号构建设置为YES
Doe just figured how to get rid of hundreds of warning like this :
set for an entire target or project with the Symbols Hidden by Default build setting to YES
链接器抱怨您的项目和 Boost 之间的可见性设置不同。
您还可以通过使用相同的兼容性设置重新编译 Boost 来解决该问题。
只需将
和
添加到
bjam
命令行即可。The linker complains about different visibility settings between your project and Boost.
You can also fix that issue by recompiling Boost with the same compatibility settings.
Just add
and
to the
bjam
command line.将默认隐藏的符号设置为NO并将隐藏内联方法设置为NO对我有用。无需添加任何标记为其他 C++ 标记
Setting Symbols Hidden by Default to NO and Inline Methods Hidden to NO worked for me.No need to add any flag to Other C++ flags
如果多个项目包含 boost,则每个项目必须具有相同的
默认隐藏符号 值
nerith说的隐藏内联方法
是对的,但是在Xcode 4.6.3中,它们不是上面的“默认隐藏符号”和“隐藏内联方法”,并且我将gcc_symbols_private_extern设置为yes,警告消失了。
If boost is included by multiple projects, each project must have the same values for
Symbols Hidden by Default
Inline Methods Hidden
nerith said is right, but in Xcode 4.6.3,they is not the above "Symbols Hidden by Default" and "Inline Methods Hidden", and i set the gcc_symbols_private_extern to yes, the warning is disappear.