To create a static library:
- Create a static library project in Xcode
- Add all .c and .h file to the project
- Compile
The easiest way to use this library is to add this static library project to the application project. This allows you not to worry about creating thick libraries (that is, libraries with code for the simulator and device).
To add a static library project to an application project:
- Choose File> Add Files To ...
- Add .xcodeproj for your static library
- Click on your .xcodeproj application in the Project Navigator to display the build options.
- Click on the target application and select the Build Phases tab.
- Expand the link "Link with binaries"
- Click the "+" button
- Expand the "Workspace" section (you will see your library, the .a file) there
- Click on your library and you should be fine.
Sorry for the excruciating level of detail above, but for some reason people always seem to forget to do steps 4-8, and then wonder why they get link errors!
Xcode cannot find headers for your library. You can add public headers to your project, like any other header file, or set "header search paths" in the build settings.
source share