xcode with boost : linker(Id) 关于可见性设置的警告

发布于 2024-12-23 16:18:38 字数 671 浏览 2 评论 0原文

我一直在为我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

念﹏祤嫣 2024-12-30 16:18:39

我也遇到了这个问题。

事实证明,我不小心做了这样的事情:

#pragma GCC visibility push(default)
#include <SomeExternalLibrary.h>
void myExampleSymbol();
#pragma GCC visibility pop

我通过更改为解决了这个问题:

#include <SomeExternalLibrary.h>
#pragma GCC visibility push(default)
void myExampleSymbol();
#pragma GCC visibility pop

I also had this problem.

It turns out that I was carelessly doing something like this:

#pragma GCC visibility push(default)
#include <SomeExternalLibrary.h>
void myExampleSymbol();
#pragma GCC visibility pop

Which I solved by changing to:

#include <SomeExternalLibrary.h>
#pragma GCC visibility push(default)
void myExampleSymbol();
#pragma GCC visibility pop
寂寞笑我太脆弱 2024-12-30 16:18:38

如果 boost 被多个项目包含,则每个项目必须具有相同的值

 Symbols Hidden by Default
 Inline Methods Hidden

If boost is included by multiple projects, each project must have the same values for

 Symbols Hidden by Default
 Inline Methods Hidden
酒中人 2024-12-30 16:18:38

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

失去的东西太少 2024-12-30 16:18:38

链接器抱怨您的项目和 Boost 之间的可见性设置不同。

您还可以通过使用相同的兼容性设置重新编译 Boost 来解决该问题。

只需将

cxxflags=-fvisibility=hidden

cxxflags=-fvisibility-inlines-hidden

添加到 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

cxxflags=-fvisibility=hidden

and

cxxflags=-fvisibility-inlines-hidden

to the bjam command line.

就像说晚安 2024-12-30 16:18:38

默认隐藏的符号设置为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

半暖夏伤 2024-12-30 16:18:38

如果多个项目包含 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文