Iphone – Linking Static Libraries in iPhone SDK 3.0

cocoa-touchiphonexcode

I have an iPhone app that heavily relies on the OpenCV library; as such, I've compiled a static version of this library for inclusion with my app. The instructions for doing this are relatively straightforward: Using OpenCV on iPhone. The only gotcha I ran into was setting the linker flag, STANDARD_C_PLUS_PLUS_LIBRARY_TYPE to "standard". The app compiled and ran perfectly under OS 2.0 and 2.2.

After upgrading to SDK 3.0 and trying to re-compile my app, I'm running into an issue with this linker flag. I'm getting this error while linking:

ld: library not found for -lstdc++-static

It's also interesting that on my system, "libstdc++-static" is present under seemingly every iPhoneOS and iPhoneSimulator SDK except for iPhoneOS.platform/SDKs/iPhoneOS3.0.sk. Here are the search results:

$ 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

I'm pretty baffled and haven't been able to find any answers on Google or iPhone dev forums. I'd really appreciate if someone could shed some light here.

Thanks!

Best Answer

Just a guess - try adding one of the directories to the 'Library Search Paths' option in Build Properties?

Related Topic