title: error while loading shared libraries: libnsd.so: cannot open shared object file: No such file or directory
body: <p>I'm writing two C programs. One of them uses library <code>libnsd.so</code>. I compile two C programs using makefile which looks like this:</p>
  
  <pre><code>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 $&lt; -o $@
  
  
  
   nsd.o: nsd.c nsd.h nd.h
  
   nd.o: nd.c nsd.h nd.h
  
  
  
  clean:
      $(RM) -rf *.o *.so main
  </code></pre>
  
  <p>When I try to run an aplication I get an error: </p>
  
  <blockquote>
    <p>error while loading shared libraries: libnsd.so: cannot open shared
    object file: No such file or directory</p>
  </blockquote>
  
  <p>Anyone knows how to solve it?</p>