ShanZhengYang
ShanZhengYang

Reputation: 17631

Makefile error: /usr/bin/ld: cannot find -lsqlite3

I've installed sqlite3 from source on Linux and placed this into the subdirectory of C code with a Makefile. This is what the Makefile looks like

CC      = gcc
CFLAGS  = -Wall -g -std=c99

SOURCES := src/file1.c src/file2.c src/file3.c
LIB     := -lm -lsqlite3 
INC     := -I include -I path/to/pathname/sqlite3/include 

all:
    @mkdir -p bin/

    $(CC) $(CFLAGS) $(SOURCES) main.c  -L path/to/pathname/sqlite3/ -o bin/software $(LIB) $(INC)

clean:
    rm -f bin/sofware

However, whenever I try executing make, I get this error:

gcc -Wall -g -std=c99 src/file1.c src/file2.c src/file3.c -I include -I path/to/pathname/sqlite3/include 
/usr/bin/ld: cannot find -lsqlite3
collect2: error: ld returned 1 exit status
make: *** [all] Error 1

I don't understand. sqlite3 is in path/to/pathname/sqlite3/

Here is the list of files/executables in path/to/pathname/sqlite3/:

aclocal.m4      config.log     configure.ac  install-sh     ltmain.sh    missing  shell.o       sqlite3.h   sqlite3.pc.in
autom4te.cache  config.status  depcomp       lib            Makefile     README   sqlite3       sqlite3.lo  tea
bin             config.sub     include       libsqlite3.la  Makefile.am  share    sqlite3.c     sqlite3.o
config.guess    configure      INSTALL       libtool        Makefile.in  shell.c  sqlite3ext.h  sqlite3.pc

How does one properly allow this C code to compile properly with access to sqlite3?

Upvotes: 0

Views: 2710

Answers (1)

london-deveoper
london-deveoper

Reputation: 543

You need to add -L/path/to/lib/dir

Upvotes: 1

Related Questions