Compiling custom SQLite for an iPhone app
I’m trying to compile the SQLite amalgamation source into my iPhone app (to give me access to the full-text searching functionality that isn’t available in the iPhone-compiled version of the binary.
When I add sqlite3.c and sqlite3.h to a normal Carbon C app template, it compiles just fine (with a single warning about an unused variable), but when I try compiling it in my iPhone project I get a number of errors relating to missing function declarations. I’m able to solve these problems by explicitly including ctype.h, but it’s a little strange.
However, even after it builds it fails on linking with the following error:
"_sqlite3_version", referenced from: _sqlite3_version$non_lazy_ptr in sqlite3.0 symbol(s) not found collect2: ld returned 1 exit status
I assume that it’s something in the iPhone app’s build settings, but I can’t figure it out. Any ideas?
3 Solutions Collect From Internet About “Compiling custom SQLite for an iPhone app”
Try it with this steps:
- xcode menu -> project -> new target -> static library -> target name: SQLite
- drop SQLite amalgamation source into the project, now you can select the target, choose SQLite
- xcode menu -> project -> edit active target -> tab General -> Direct Dependencies -> add SQLite
- tab General -> Linked Libraries -> add your SQLite
I’ve managed to do this using the amalgamation and dumped it straight into my project without having to do the linking catlan suggested (I’m not saying it’s a bad idea, merely it’s possible to do in the main project).
I didn’t need to edit anything (except for adding the necessary FTS define for the text searching) and compiled error free. Check your build settings and ensure ‘-sqlite3’ isn’t in your Other Linking Flags.
That type of error usually means a missing framework.
- Right- or control-click on your Project’s Frameworks folder.
- Select Add > Existing Framework…
- Go to: Macintosh HD > Developer > Platforms > iPhoneOS.platform > Developer > SDKs > iPhoneOS2.2sdk > usr > lib and select libsqlite3.dylib
- Rebuild your project
That should take care of it, I think. You may need to add a similar library for running on the iPhone Simulator.
- How do I check if a firebase database value exists?
- How do you set CMAKE_C_COMPILER and CMAKE_CXX_COMPILER for building Assimp for iOS?
- Single and double underscore difference in declaring @synthesize
- How to automatically take a picture without pressing the phototaken button on the imagepickercontroller?
- Can't set URLRequest Authorization Header
- How to collaborate on a project with Xcode Storyboards?
- extra argument userinfo in call
- How can I change the location of files in xcode project?
- Text Highlighting and add notes function in epub reader ios
- How do I alternate a UICollectiveViewCell's background color based on row?
- Why not just set initial view controller for login screen like this?
- Unrecognized Selector SenTestCase for Category
- Monotouch + UIWebView = Random Crashes
- How to use Core Data models without saving them?
- Google Maps iOS SDK, Getting Directions between 2 locations