HowTo compile native C codes to a library for iOS development in Xcode
HowTo compile native C codes to a library for iOS development in Xcode Posted on 2011/10/30 by allen For iOS development, sometimes you want to use a existed native C codes for help. Objective-C is a superset of C so it’s easy to combine C codes in your Objective-C project. But for a library usage, it only support compiling C code to a static library by now. In this tutorial, I take an open source project MQTT message broker Mosquitto as an example to demo how to compile it into a static library in Xcode. Environments * Xcode 4.1 * MacOSX Lion * mosquitto 0.13 Tutorial 1. Download mosquito form < http://mosquitto.org/files/source/mosquitto-0.13.tar.gz >. Here is the whole directory structure: 2. Create a new project by template C/C++ Library * Choose static type 3. Import(or just drap and drop) C codes(include .h and .c) to the project 4. Check the “Build settings” in project * “Base SDK” => Latest iOS * “Architecture...