AndroidCrazy
AndroidCrazy

Reputation: 334

ndk-build with sqlite library error

I am creating an android application which is having native C code along with sqlite database. When I do a ndk-build from my jni folder,I am getting the following error.

undefined reference to `sqlite3_open'
peard.c:(.text+0x588): undefined reference to `sqlite3_exec'
peard.c:(.text+0x5f8): undefined reference to `sqlite3_exec'
peard.c:(.text+0x668): undefined reference to `sqlite3_exec'
peard.c:(.text+0x6d8): undefined reference to `sqlite3_prepare_v2'
peard.c:(.text+0x720): undefined reference to `sqlite3_column_count'
peard.c:(.text+0x734): undefined reference to `sqlite3_step'
peard.c:(.text+0x774): undefined reference to `sqlite3_column_text'
peard.c:(.text+0x78c): undefined reference to `sqlite3_column_name'
peard.c:(.text+0x800): undefined reference to `sqlite3_close'

I tried to run along with -lsqlite3 command also,but doesn't work. Thanks.

Upvotes: 0

Views: 1232

Answers (2)

AndroidCrazy
AndroidCrazy

Reputation: 334

I solved the problem by adding sqlite3.c source file to my dependency files list in my Android.mk file.Special thanks to hirschhomsalz.

Narain.

Upvotes: 1

Gunther Piez
Gunther Piez

Reputation: 30439

You need to build or install sqlite3 (and all other non standard libraries you project depends on) for android, and the build your project with the -L and -I parameters pointing to the arm version of you sqlite libraries and headers.

Upvotes: 0

Related Questions