help needed urgently for problem in linking the shared libraries (
.so )
swapnil kamble
swap.kamble at gmail.com
Mon Jan 9 09:49:08 PST 2006
Hi all,
I am Swapnil . I wanted to link the shared libraries . Let
me tell you how I tried to link them but I am not too sure whether it
is correct or not ,I did it according to tutorial . I wrote some
libraries by using X lib for instance some header "test.h" in which I
wrote function prototypes , a sample program sample.c and body of
functions defined in header is in file def.c . As all files are in
same dir then there no problem while compiling and running . Next I
created Makefile it consists of following statements
all:
gcc -lX11 -L/usr/X11R6/lib/ -lncurses -lm sample.c def.c -o try
till here everything is OK after this I modified Makefile to create
shared libraries like this
all:
gcc -lX11 -L/usr/X11R6/lib/ -lncurses -lm -shared sample.c
def.c -o try.so
Shared object created successfully . then I copied header test,h to
/usr/include then I copied try.so to /usr/X11R6/lib then I run
command
#ldconfig
to update library database (No errors here)
Next If try to compile program , then I get error for functions which
I have included
, "sample.c:(.text+0x2a3): undefined reference to `function_name'
If you know something is wrong here or way is to do it this then
please tell me immediately I would have been very thankful to them .
Hare Krishna
...Swapnil
More information about the xorg-arch
mailing list