iOS conditional link static library

本秂侑毒 提交于 2019-12-23 22:13:56

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!