问题描述
我正在构建一个项目,在该项目中我启用了 GCC_INLINES_ARE_PRIVATE_EXTERN
和 GCC_SYMBOLS_PRIVATE_EXTERN
,因为我正在使用使用这些标志预先构建的静态库.
I am building a project in which I have enabled GCC_INLINES_ARE_PRIVATE_EXTERN
and GCC_SYMBOLS_PRIVATE_EXTERN
because I am consuming static libraries that were pre-built with those flags on.
但是,当我为调试构建我的项目时,-fvisibility=hidden
不包含在编译器标志中,但是当我为发布构建我的项目时它会被包含在内.
However, when I build my project for Debug -fvisibility=hidden
is not included in the compiler flags, but it does get included when I build my project for Release.
是否还有其他标志需要我打开才能实现?
Is there any other flag that I need to turn on to make this happen?
推荐答案
这是旧的,但似乎冲突来自启用可测试性设置.如果您将其关闭,则 -fvisibility=hidden 将正常工作.似乎启用可测试性比 GCC_SYMBOLS_PRIVATE_EXTERN 具有更高的优先级.
This is old, but it it seems the conflict comes from the Enable Testability setting. If you turn that off, then -fvisibility=hidden will work properly. It seems that Enable Testability has higher precedence over GCC_SYMBOLS_PRIVATE_EXTERN.
如果您需要该设置,您可以随时根据配置修改设置并混合搭配(即启用可测试性和包含 -fvisibility=hidden 的 OTHER_CFLAGS)
If you need that setting, you can always modify the settings on a configuration basis and mix and match (ie. Enable Testability is on and OTHER_CFLAGS containing -fvisibility=hidden)
这篇关于-fvisibility=hidden 没有被编译器传递给调试版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!