Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   LD cant find the library (http://www.go4expert.com/forums/ld-library-t15412/)

agnimidhun 5Dec2008 14:27

LD cant find the library
 
Hi All,

I am compiling a program with gcc on Fedora 8 machine (gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)). It requires libsqlite3. I compile it as follows:

gcc -Wall -g showbs4.c -o showbs4 `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0` -L/usr/lib/ -lsqlite3.so

ls -l /usr/lib/libsqlite3.so* shows:

lrwxrwxrwx 1 root root 19 2008-12-05 13:41 /usr/lib/libsqlite3.so -> libsqlite3.so.0.8.6
lrwxrwxrwx 1 root root 19 2007-11-02 19:49 /usr/lib/libsqlite3.so.0 -> libsqlite3.so.0.8.6
-rwxr-xr-x 1 root root 435812 2007-09-28 18:24 /usr/lib/libsqlite3.so.0.8.6

LD_LIBRARY_PATH is set to :

LD_LIBRARY_PATH=/usr/lib


gcc is still not able to find libsqlite3. How do I tell gcc to include the libsqlite3 ?:thinking:


This might be trivial. But I have not been able to figure as to what else I can do. :embarasse

Thanks,
Midhun

xpi0t0s 6Dec2008 03:44

Re: LD cant find the library
 
-lXYZ is a linker shortcut; it tells the linker to look for libXYZ.a, e.g. to link with libm.a you just specify -lm. So if you specify -lsqlite3.so the linker dutifully adds lib and .a and goes off looking for libsqlite3.so.a. If you want it to link with sqlite3.so, just leave the -l prefix off.


All times are GMT +5.5. The time now is 17:34.