I am writing two programs in C. One of them uses a library libnsd.so. I will compile two C programs using a makefile that looks like this:
CC=gcc
CFLAGS= -Wall -g -O -fPIC
RM= rm
HLAV=main
HLAVO=main.o
all:lib $(HLAV)
cc c2.c -o c2
main: $(HLAVO)
$(CC) -L. -o $(HLAV) $(HLAVO) -lnsd
lib: libnsd.so
libnsd.so: nsd.o nd.o
$(CC) -shared $< -o $@
nsd.o: nsd.c nsd.h nd.h
nd.o: nd.c nsd.h nd.h
clean:
$(RM) -rf *.o *.so main
When I try to start the application, I get an error message:
when loading shared libraries: libnsd.so: unable to share object file: No such file or directory
Does anyone know how to solve it?
Lemmy source
share