How can I combine object files (.o) to create a static library (.a) for iOS?

I have compiled the library and there are object files (.o). Now I want to combine them in a static library using ar. I can do this, but when I add this file to the iOS project, it says the library is an archive type and the architecture linking is arm7. How do I get around this?

solved

ar -crs libstatic.a * .o I used to use ar from the iOS SDK and I think this is why it was failing.

+3


source to share


2 answers


The best resource I've found on this topic is here:

http://sgleadow.github.com/blog/2011/10/28/universal-static-libraries-and-frameworks-for-ios/



It is a lengthy process, but every step is required for this to work as expected.

+2


source


ar -rcs libexample.a *.o

      

Link the library to the switch:



 -lexample

      

+2


source







All Articles