1

I'm using raspberry pi 2B with raspbian lite.

I'm trying to add an sqlite3 library on my C++ program. Without starting adding any piece of code, using the flag -lsqlite3 I get the error.

src/main.cpp src/radio/radio.cpp src/radio/sx1276/sx1276.cpp src/file_manager/file_manager.cpp
g++ -g -Wall -lwiringPi -l sqlite3 -o lora src/main.cpp src/radio/radio.cpp src/radio/sx1276/sx1276.cpp src/file_manager/file_manager.cpp
/usr/bin/ld: cannot find -lsqlite3
collect2: error: ld returned 1 exit status
Makefile:13: recipe for target 'all' failed
make: *** [all] Error 1

I have installed the sqlite3 on my system.

pi@raspberrypi:~ $ sudo apt-get install sqlite3
Reading package lists... Done
Building dependency tree
Reading state information... Done
sqlite3 is already the newest version (3.16.2-5+deb9u1).
The following packages were automatically installed and are no longer required:
  libboost-filesystem1.58.0 libboost-program-options1.58.0 libboost-system1.58.0 libboost-thread1.58.0 libboost-thread1.62.0 libmongoclient-dev libmongoclient0 libpcap0.8 libpcrecpp0v5 libsnappy1v5 libv8-3.14.5 mongodb-clients
  mongodb-dev mongodb-server
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
MrBit
  • 141
  • 5

1 Answers1

4

To be able to link an SQLite3 program you need the libsqlite3 (run-time) and libsqlite3-dev (development) libraries installed.

Install those with sudo apt install libsqlite-dev (which will pull in the run-time dependency).

Dougie
  • 5,381
  • 11
  • 22
  • 30