title: Why does the GNU linker not find a shared object with -l<library>?
body: <p>I'm getting an error when trying to link an object file:</p>
  
  <pre><code>$ g++ -o intro intro.o -L -Wl,-rpath-link  -lnotes -lm -lnsl -lpthread -lc -lresolv -ldl
  /usr/bin/ld: cannot find -lnotes
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>However, the library seems to be there (in fact, I put it there by including <code>/opt/ibm/lotus/notes</code> in a file in <code>/etc/ld.so.conf.d/</code> and running <code>ldconfig</code>):</p>
  
  <pre><code>$ ldconfig --print-cache | grep libnotes                                                      
  361:    libnoteswc.so (libc6) =&gt; /opt/ibm/lotus/notes/libnoteswc.so
  362:    libnotes.so (libc6) =&gt; /opt/ibm/lotus/notes/libnotes.so
  </code></pre>
  
  <p>Why does the linking fail and how can I bring the linker to use these shared objects?</p>