title: How to include a dynamic library in C++
body: <p>If I search for files that include file <em>libusb.h</em>,</p>
  
  <pre><code>$grep -r "libusb.h" /usr/local/lib/
  </code></pre>
  
  <p>I get:</p>
  
  <blockquote>
    <p>Binary file /usr/local/lib//libusb-1.0.0.dylib matches<br/>
    Binary file /usr/local/lib//libusb-1.0.a matches<br/>
    Binary file /usr/local/lib//libusb-1.0.dylib matches</p>
  </blockquote>
  
  <p>But when I compile my class I get:</p>
  
  <pre><code>test.cpp:2:10: fatal error: 'libusb.h' file not found
  #include &lt;libusb.h&gt;
  </code></pre>
  
  <p>Now I know this is because the <em>/usr/local/lib</em> folder isn't properly included. I tried things like the following, etc., but nothing seems to fix it.</p>
  
  <pre><code>gcc -lusb test.cpp
  C_INCLUDE_PATH=/usr/local/lib
  export C_INCLUDE_PATH
  </code></pre>
  
  <h1>Update</h1>
  
  <p>Thanks to some of the help, I have come up with this command...</p>
  
  <pre><code>gcc test.cpp -I/usr/local/include -L/usr/local/lib -lusb-1.0
  </code></pre>
  
  <p>But now I get...</p>
  
  <pre><code>ld: symbol(s) not found for architecture x86_64
  </code></pre>
  
  <p>I tried adding</p>
  
  <blockquote>
    <p>-stdlib=libstdc++</p>
  </blockquote>
  
  <p>But that doesn't seem to help either.</p>