为iPhone应用程序编译自定义SQLite [英] Compiling custom SQLite for an iPhone app
问题描述
我正在尝试将 SQLite合并来源编译到我的iPhone应用中(给我访问iPhone编译版本的二进制文件中没有的全文搜索功能。
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.
当我添加sqlite3.c和sqlite3.h时正常的Carbon C应用程序模板,它编译得很好(只有一个关于未使用的变量的警告),但是当我尝试在我的iPhone项目中编译它时,我得到了许多与缺少函数声明有关的错误。我能够解决这些问题。显式包含ctype.h的问题,但是有点奇怪。
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
我认为它是iPho中的东西ne app的构建设置,但我无法弄清楚。有什么想法?
I assume that it's something in the iPhone app's build settings, but I can't figure it out. Any ideas?
推荐答案
尝试按照以下步骤操作:
Try it with this steps:
- xcode菜单 - >项目 - >新目标 - >静态库 - >目标名称:SQLite
- 将SQLite合并源放入项目中,现在可以选择目标,选择SQLite
- xcode菜单 - >项目 - >编辑活动目标 - >选项卡常规 - >直接依赖关系 - >添加SQLite
- 选项卡常规 - >链接库 - >添加您的SQLite
- 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
这篇关于为iPhone应用程序编译自定义SQLite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!