问题
I have a fat static library compiled for armv7 and i386. In my iPhone/iPad project everything works fine, but i can only install my application on armv7 device so iPhone 3gs and up...
There is a way to run my project on armv6 so i can install it on an ipod touch and an old iphone version (also if i disable the use of armv7 library).
I try this:
#ifdef _ARM_ARCH_7
... //include and use of armv7 library
#else
... //not include armv7 library
#endif
but when i compile my project i have link error...
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang++ failed with exit code 1
So there is a way to run my app on all kind of device but link a specific library when compiling for armv7???
Thanks for help!
回答1:
You need to weak-link that library. Open up build settings and find Other Linker Flags. You need to add two entries, the first is "-weak_library", the second is the path of the library file (you may need to hunt through what's being passed to the linker to find what this is).
They need to be in that order as this list is turned into parameters to the linker in the order they're presented.
来源:https://stackoverflow.com/questions/8298076/ios-conditional-link-static-library