0

I want to know the step by step process of creating a static library (.a file) so that it could be exposed to other projects. This is how I am doing it right now:

  1. Right click on "Targets" --> Add --> New Target.
  2. Choose "Static Library" --> Next --> Gave some name & Finish
  3. Added build dependencies
  4. Dragged the header file to be exposed for other projects to "Copy headers"
  5. Dragged and dropped all the files to be compiled under "Compile Sources"
  6. Dragged and dropped the libraries in "Link Binary With Libraries".

What is next? How to get the .a file after this and if there is a script from where do I need to run it?

Abhinav
  • 37,684
  • 43
  • 191
  • 309

2 Answers2

1

Step by step instructions that may help you:

http://blog.stormyprods.com/2008/11/using-static-libraries-with-iphone-sdk.html

http://kyleroucis.com/Kyle_Roucis/Blog/Entries/2009/10/7_Custom_Embedded_Static_Library_for_iPhone.html

Rog
  • 18,602
  • 6
  • 76
  • 97
  • I followed this path and I am getting thousands of errors ... Seems like none of the IOS SDK method is being identified by the compiler. I am getting errors like "NSAutoreleasePool undeclared", "nil undeclared" etc. – Abhinav Mar 28 '11 at 22:17
  • 1
    Stormyoprods blog approach was great originally, but has been out of date for a long time, I wouldn't go that way. – Adam Mar 28 '11 at 23:43
0

If you are using XCode 4 this is fairly easy:

  1. File > New > New Project
  2. Framework & Library > Cocoa Touch Static Library

The rest is just personal preferences. Once you are finished (and have build your library) the '.a' file can be accessed under the 'Products' (use show in finder).

Kevin Sylvestre
  • 37,288
  • 33
  • 152
  • 232
  • 1
    Create a new project, as Kevin points out (and in Xcode3 its the same basic process, just an extra click), and then do something like this to get a single .a file out the other end: http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4 – Adam Mar 28 '11 at 23:42