title: Link .so file to .cpp file via g++ compiling
body: <p>i am trying to get a library to work in my c++ project and there is no clear instructions of how to do this for people who are not used to c++</p>
  
  <p>the following <a href="http://www.cplusplus.com/forum/unices/33532/" rel="noreferrer">link</a> is the closest i have come</p>
  
  <p>it states the following</p>
  
  <pre><code>-L/path/to/my/library/folder -ldllname
  </code></pre>
  
  <p>also the following <a href="https://stackoverflow.com/questions/1142103/how-do-i-load-a-shared-object-in-c">thread</a> states the following</p>
  
  <pre><code>gcc yourfile.cpp -lblah
  </code></pre>
  
  <p>now from what i can see the command is <code>-l</code> + <code>filename</code>, for example my filename is <code>directory/libtest.so</code> it would be <code>-ldirectory/libtest.so</code>, is this correct, could someone clarify</p>
  
  <p>i am currently using the following command to compile my <code>maincpp.cpp</code> file, would like to however include a .so file called for example <code>./directory/libtest.so</code></p>
  
  <pre><code>g++ -fPIC -o libgetmacip.so -shared -I $JAVA_HOME/include -I $JAVA_HOME/include/linux maincpp.cpp cpptoinclude.cpp
  </code></pre>