title: Linking to so library in gcc
body: <p>I will start by saying that I am new to gcc and makefiles. I have a .so file on the desktop (~/Desktop) called <code>lib.so</code>. I want to link my program (called myProgram) to it. What I wrote in my makefile is: </p>
  
  <pre><code>g++ myProgram.o -L ~/Desktop -l lib -o myProgram
  </code></pre>
  
  <p>When I run <code>make</code> I get an error:</p>
  
  <pre><code>/usr/bin/ld: cannot find -llib
  </code></pre>
  
  <p>I also tried <code>-l lib.so</code> and got the same error.
  What is the correct way to link?    </p>