0

I am trying to compile my c code on linux i386. I have the sqlite3 library at:

/usr/lib/i386-linux-gnu/libsqlite3.so.0
/usr/lib/i386-linux-gnu/libsqlite3.so.0.8.6

but the linker does not find them. I even specified the path manually with the -L option which I suspect is not necessary:

cc -pthread -L/lib/i386-linux-gnu -L/usr/lib/i386-linux-gnu -L../i386/debug/lib/ ./bin/i386/debug/*.o  -lsculib -lpthread -lsqlite3 -o ../i386/debug/bin/myProgram
/usr/bin/ld: cannot find -lsqlite3
collect2: error: ld returned 1 exit status
make: *** [../i386/debug/bin/core] Error 1

any ideas why it does not find them?

max
  • 9,708
  • 15
  • 89
  • 144

1 Answers1

1

Presumably, you also need the header files.

$ sudo apt-get install libsqlite3-dev
Michael - sqlbot
  • 169,571
  • 25
  • 353
  • 427
  • Thanks a lot. That fixed the problem. Although, I'm now getting some strange errors: undefined reference to `sqlite3_free' but it is defined in /usr/include/sqlite3.h Below is how I'm using it. ----------------- database.h #ifndef __DATABASE_H__ #define __DATABASE_H__ #include ----------------- database.c #include "database.h" sqlite3_free(errMsg); <---- Causes link Error – max Nov 08 '13 at 05:47
  • I figured out. In my link command, I should specify the sqlite3 package after the source filename which requires it. – max Nov 08 '13 at 06:42