Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/108.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
编译使用Boost的iOS应用程序时的可见性链接器警告_Ios_Xcode_Boost_Linker_Clang - Fatal编程技术网

编译使用Boost的iOS应用程序时的可见性链接器警告

编译使用Boost的iOS应用程序时的可见性链接器警告,ios,xcode,boost,linker,clang,Ios,Xcode,Boost,Linker,Clang,我的iOS应用程序使用一个库,而这个库又依赖于Boost。在改造第三方构建系统时,我遇到了如下链接器警告 ld: warning: direct access in ___cxx_global_var_init to global weak symbol std::__1::basic_ofstream<char, std::__1::char_traits<char> >::~basic_ofstream() means the weak symbol cannot b

我的iOS应用程序使用一个库,而这个库又依赖于Boost。在改造第三方构建系统时,我遇到了如下链接器警告

ld: warning: direct access in ___cxx_global_var_init to global weak symbol
std::__1::basic_ofstream<char, std::__1::char_traits<char> >::~basic_ofstream()
means the weak symbol cannot be overridden at runtime.
This was likely caused by different translation units being compiled with different visibility settings.
我看到关于这个警告还有很多其他的问题。我遵照他们的建议,确保所有版本中的可见性设置都相同(
-fvisibility=hidden
-fvisibility inlines hidden
)。经过全面重建后,我仍然收到警告

环境:

  • Xcode 4.6.0
  • iOS SDK 6.1
  • 使用流行构建脚本的修改克隆构建Boost
  • Boost版本1.54.0
  • 使用
    -std=c++11-stdlib=libc++

问题在于Boost构建脚本使用了
clang++
作为编译器,但另一个库和我自己的iOS应用程序使用了
clang
(另一个库和我的应用程序是Xcode项目,其中构建是使用
clang

在我用
clang
重建Boost后,警告消失了

可悲的是,我不知道这到底是为什么。我知道编译用<代码> CLAN++<代码>将编译器切换到C++模式,打开/关闭某些设置。但这当然不意味着使用
clang++
会覆盖在命令行上明确指定的可见性设置?!欢迎评论或其他解释行为的答案

ld: warning: direct access in __GLOBAL__I_a to global weak symbol
boost::exception_ptr::~exception_ptr()
means the weak symbol cannot be overridden at runtime.
This was likely caused by different translation units being compiled with different visibility settings.