title: Compiling against libusb-dev on Ubuntu
body: <p>I am trying to compile the example libusb.c provided by libusb package (if you dl the source code.)</p>
  
  <p>It doesn't work to say the least. </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;sys/types.h&gt;
  #include &lt;libusb/libusb.h&gt;
  </code></pre>
  
  <p>That causes it to fail, there is no <code>libusb/libusb.h</code> it's <code>usb.h</code>, so I change that. And it fails in new and innovative ways.</p>
  
  <p>I've copied the file over, exactly, and named it example.c</p>
  
  <p>I am using these commands and variations:</p>
  
  <pre><code>gcc -o example example.c -lusb -L /usr/lib/libusb.a
  gcc -o example example.c -lusb -L /usr/lib/libusb.so
  </code></pre>
  
  <p>The errors I get when compiling are:</p>
  
  <pre><code>example.c:25: error: expected ‘)’ before ‘*’ token
  example.c: In function ‘main’:
  example.c:46: error: ‘libusb_device’ undeclared (first use in this function)
  example.c:46: error: (Each undeclared identifier is reported only once
  example.c:46: error: for each function it appears in.)
  example.c:46: error: ‘devs’ undeclared (first use in this function)
  
  Line 25: static void print_devs(libusb_device **devs)
  
  Line 46: libusb_device **devs;
  </code></pre>
  
  <p>At first I followed a tutorial, and that failed to compile, in more or less the same ways, so I decided to just try the provided example, and that failed.</p>
  
  <p>Can anyone help me out? Explain what I am doing wrong, cause I am lost on this one.</p>