链接iPhone SDK 3.0中的静态库

时间:2009-07-07 22:11:18

标签: iphone cocoa-touch xcode

我有一个严重依赖OpenCV库的iPhone应用程序;因此,我编译了这个库的静态版本以包含在我的应用程序中。执行此操作的说明相对简单:Using OpenCV on iPhone。我遇到的唯一问题是将链接器标志STANDARD_C_PLUS_PLUS_LIBRARY_TYPE设置为“standard”。该应用程序在OS 2.0和2.2下编译并完美运行。

升级到SDK 3.0并尝试重新编译我的应用程序后,我遇到了此链接器标志的问题。链接时我收到此错误:

ld:找不到-lstdc ++的库 - 静态

有趣的是,在我的系统中,除了iPhoneOS.platform / SDKs / iPhoneOS3.0.sk外,“libstdc ++ - static”似乎存在于所有iPhoneOS和iPhoneSimulator SDK下。以下是搜索结果:

$ locate libstdc++-static
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/lib/libstdc++-static.a
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.1.sdk/usr/lib/libstdc++-static.a
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.1.sdk/usr/lib/libstdc++-static.a
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk/usr/lib/libstdc++-static.a
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/usr/lib/libstdc++-static.a
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.1.sdk/usr/lib/libstdc++-static.a
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk/usr/lib/libstdc++-static.a
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.sdk/usr/lib/libstdc++-static.a
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/usr/lib/libstdc++-static.a
/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libstdc++-static.a
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libstdc++-static.a
/usr/lib/libstdc++-static.a

我非常困惑,无法在Google或iPhone开发论坛上找到任何答案。如果有人能在这里说清楚,我真的很感激。

谢谢!

2 个答案:

答案 0 :(得分:1)

只是猜测 - 尝试将其中一个目录添加到Build Properties中的“Library Search Paths”选项中?

答案 1 :(得分:0)

这真是令人费解,我唯一能想到的是/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk不在您的图书馆搜索路径中,但这种可能性很小。