g++ cannot find shared library
<p>I apologize that this is redundant, but none of the answers available seem to be able to solve my problem.  I am attempting to compile an executable using a shared object library.  The shared object library is called <code>libsession.so</code> and is found in the same directory that I am compiling the executable.  To compile and link, I use the following command</p>

<p><code>
g++ test_main.cpp -o program -std=c++11 -I ../src/base -L. -lsession
</code></p>

<p>Unforutanely, I get the <em>cannot find -lsession</em> error when linking.  If I change the command to directly reference the shared library as follows</p>

<p><code>
g++ test_main.cpp -o program -std=c++11 -I ../src/base libsession.so
</code></p>

<p>then the executable compiles/links and all is well.  Does anyone have any thoughts as to what I may be doing wrong?</p>