在iPhone上使用boost

在iPhone上使用boost,iphone,boost,linker,Iphone,Boost,Linker,经过多次黑客攻击,我成功地为iphone编译了boost库,包括设备和模拟器,但当我尝试使用它们时,xcode调试器中出现了一个错误,它说: dyld: Library not loaded: libboost_graph.so.1.40.0 我猜这是一个动态库加载器,在iphone上是不允许的。我正在使用-Lboost\u graph作为编译器标志链接应用程序 这是我用于构建boost的脚本: ./bjam $1 $2 $3 \ toolset=darwin \

经过多次黑客攻击,我成功地为iphone编译了boost库,包括设备和模拟器,但当我尝试使用它们时,xcode调试器中出现了一个错误,它说:

dyld: Library not loaded: libboost_graph.so.1.40.0
我猜这是一个动态库加载器,在iphone上是不允许的。我正在使用
-Lboost\u 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文件)

我可能错了,但我认为您需要将应用程序静态链接到boost-来自dyld的错误消息表明您当前正在链接到动态boost库(请注意错误消息中的
.so
后缀-您希望链接到静态后缀-libboost.a。)

您可能希望将应用程序链接到以下内容:

-iboost_graph -static

(假设.a文件名为
libboost\u graph.a

似乎与-static链接会使编译器退回到另一个链接器,并给出另一个错误:“ld\u classic:找不到:-lcrt0.o的文件”至少我在google上找到了另一个编译器标志:)你找到解决此问题的方法了吗?请参阅此相关答案: