0

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.
  • 3
    Have you installed libsqlite3-dev? – Dougie Jun 4 at 17:20
  • no, I have not. – MrBit Jun 4 at 17:22
  • 2
    That seems to be your answer. Library not found because library is not present. packages.debian.org/sid/libsqlite3-dev – Brick Jun 4 at 17:27
  • Yes. It works! Thank you! – MrBit Jun 4 at 17:27
2

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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.