title: Using Linux C++ shared and static libraries in a same program
body: <p>How can I use both C++ shared and static libraries in a same Linux program?</p>
  
  <p>When managing with g++, I've tried to arrange <code>-static</code> command ahead and behind the libraries I don't want to link statically, but with no results. <code>ld</code> through <code>g++</code> complains about where are the .a files of the shared libraries (<em>cannot find -lwhatever</em> error).</p>
  
  <p><strong>EDIT</strong>: the problem isn't the <em>cannot find -lwhatever</em> error, since it just happens because there isn't static version of the specified library. What I'm trying to do is to specify which libraries are to be statically linked and which are to be dynamically. </p>