在iPhone上使用boost

经过很多黑客攻击,我已经设法为
iphone,设备和模拟器编译了boost-libraries,但是当我尝试使用它们时,我在xcode调试器中遇到错误说:

dyld: Library not loaded: libboost_graph.so.1.40.0

我猜是一个动态的图书馆装载机,不允许在iPhone上.我将应用程序与-Lboost_graph链接为编译器标志.

这是我用于构建boost的脚本:

./bjam $1 $2 $3 \
        toolset=darwin \
        architecture=arm \
        target-os=iphone \
        macosx-version=iphone-3.0 \
        define=_LITTLE_ENDIAN \
        --layout=system \
        --libdir=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib \
        --includedir=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include \
        link=static \
        runtime-link=static

./bjam $1 $2 $3 \
        toolset=darwin \
        architecture=x86 \
        target-os=iphone \
        macosx-version=iphonesim-3.0 \
        --layout=system \
        --libdir=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/usr/lib \
        --includedir=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/usr/include \
        link=static \
        runtime-link=static

我猜我错过了一些非常基本的东西,但是什么?

是为动态加载编译的库(平台/usr/lib中有.a文件和.so文件)

最佳答案 我可能错了,但我认为您需要静态链接您的应用程序 – 来自dyld的错误消息表明您当前正在链接到动态提升库(请注意错误消息中的.so后缀 – 您希望是链接静态的 – libboost.a

您可能想要将您的应用与以下内容相关联:

-iboost_graph -static

(假设.a文件名为libboost_graph.a)

点赞