title: Getting 'error while loading shared libraries' when using -L to specifically find the library
body: <p>I've been trying to solve this for a few hours now. 
  I am compiling some c files using gcc. The files require libpbc, so I am using the -L flag to point gcc at the directory which contains libpbc.so.1. The code compiles without error yet when I attempt to run it I get the following error message:</p>
  
  <blockquote>
    <p>./example.out: error while loading shared libraries: libpbc.so.1: cannot open shared object file: No such file or directory</p>
  </blockquote>
  
  <p>Looking at similar questions this error message seems to indicate that gcc can't find libpbc.so.1. I know gcc sees libpbc.so.1 because when I rename libpbc.so.1 to something else it fails to compile.</p>
  
  <p>I am using -L to point to the directory which contains libpbc.so.1.</p>
  
  <p>Not sure what next steps I can take to figure this out. Would appreciate any ideas. What does this error message mean exactly?</p>
  
  <h1>EDIT</h1>
  
  <p>Running ldd example.out results in:</p>
  
  <pre><code>linux-gate.so.1 =&gt;  (0xb7fe3000)
  libpbc.so.1 =&gt; not found
  libgmp.so.3 =&gt; /usr/lib/libgmp.so.3 (0xb7f87000)
  </code></pre>