The first is the source file that needs to be compiled into. A
hello.h :
#ifndef __include_hello_h__#define __include_hello_h__void HELLO (const char *name); #endif//End __include_hello_h__
hello.c
#include "stdio.h" void Hello (const char *name) { printf ("Hello World%s\n", name);}
1. Create a library Project with Xcode
2, to configure
Remove the original. h and. M:
Add the above. C and. H to the project:
Configuration item minimum configuration is iOS6.0
3, compile, get libhello.a
Open to the directory, you can view, has generated the emulator's. A library and the real machine. A library
4, in the test project to test the generated . A library
Simulator's:
The real machine (need to load the library note is not the same):
5. Merge the real hangar and simulator library into one piece
Use Lipo-create (three files to merge together)-output (file name merged together)
First I copy these two files to the desktop, then modify the corresponding name, one for libhelloi386.a and the other for libhello7.a, and then execute the following command on the terminal:
6, the entire test project (including iOS test Project and Lib Library project)
csdn:http://download.csdn.net/detail/zengraoli/8115253
Compile the. A library file used by iOS