Am facing a problem that may be slightly complicated to explain and understand as giving the entire picture would be too big and difficult.
Please excuse me for it.
Consider the following Makefile:
all: clients.so simulator backup LD_PRELOAD=/home/Juggler/client/clients.so ./simulator backup: backup.c libclient.a gcc backup.c -o backup -L /home/Juggler/client -L. -lclient -ldl simulator: simulator.c libclient.a gcc -g simulator.c -o simulator -L /home/Juggler/client -L. -lclient -ldl -pthread libclient.a: libclient.o client.o ar rcs libclient.a libclient.o client.o libclient.o:libclient.c gcc -c libclient.c -o libclient.o -pthread clients.so: client.o client_invoke.o ld -shared -o clients.so client_invoke.o client.o -ldl client_invoke.o: client_invoke.c gcc -Wall -fPIC -DPIC -c -g client_invoke.c client.o: client.c gcc -Wall -fPIC -DPIC -c -g client.c -ldl -pthread
We call function written in client.c from libclient.c and these functions in client.c make call to pthread_key_create(), pthread_setspecific..etc.
Threads are created by simulator.c and theses threads access functions written in he other files.
On doing make...Errors like the following appear.
/home/Juggler/client/libclient.a(client.o):In function 'setup_connection': /home/Juggler/client/client.c:35: undefined reference to 'pthread_setspecific'
pthread.h has been included in both client.c and libclient.c
Would be grateful for anypointers . I understand information is very less...