Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
916 views
in Technique[技术] by (71.8m points)

xcode - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try it with this steps:

  1. xcode menu -> project -> new target -> static library -> target name: SQLite
  2. drop SQLite amalgamation source into the project, now you can select the target, choose SQLite
  3. xcode menu -> project -> edit active target -> tab General -> Direct Dependencies -> add SQLite
  4. tab General -> Linked Libraries -> add your SQLite

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...