title: Visual Studio 2010 C++ - Unresolved external symbol
body: <p>I am trying to do some USB programming using the library <a href="http://www.signal11.us/oss/hidapi/" rel="nofollow">HID API</a>. Following is my code</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;wchar.h&gt;
  #include &lt;hidapi.h&gt;
  
  
  int main(int argc, char* argv[])
  {
      int res;
      unsigned char buf[65];
  #define MAX_STR 255
      wchar_t wstr[MAX_STR];
      hid_device *handle;
      int i;
  
      // Enumerate and print the HID devices on the system
      struct hid_device_info *devs, *cur_dev;
  
      devs = hid_enumerate(0x0, 0x0);
      cur_dev = devs; 
      while (cur_dev) {
          printf("Device Found\n  type: %04hx %04hx\n  path: %s\n  serial_number: %ls",
              cur_dev-&gt;vendor_id, cur_dev-&gt;product_id, cur_dev-&gt;path, cur_dev-&gt;serial_number);
          printf("\n");
          printf("  Manufacturer: %ls\n", cur_dev-&gt;manufacturer_string);
          printf("  Product:      %ls\n", cur_dev-&gt;product_string);
          printf("\n");
          cur_dev = cur_dev-&gt;next;
      }
      hid_free_enumeration(devs);
  
  }
  </code></pre>
  
  <p>I have added following into the <code>Project properties-&gt;Configuration Properties-&gt;VC++ Directories-&gt;Include Directories</code></p>
  
  <pre><code>C:\Users\yohan\Documents\HIDApi\windows
  C:\Users\yohan\Documents\HIDApi\hidapi
  C:\Users\yohan\Documents\HIDApi\libusb
  </code></pre>
  
  <p>When I run my code, I get the following error</p>
  
  <pre><code>Error   6   error LNK2019: unresolved external symbol _hid_free_enumeration referenced in function _main    c:\Users\yohan\documents\visual studio 2010\Projects\USB_Test\USB_Test\FirstTest.obj    USB_Test
  Error   7   error LNK2019: unresolved external symbol _hid_enumerate referenced in function _main   c:\Users\yohan\documents\visual studio 2010\Projects\USB_Test\USB_Test\FirstTest.obj    USB_Test
  Error   8   error LNK1120: 2 unresolved externals   c:\users\yohan\documents\visual studio 2010\Projects\USB_Test\Debug\USB_Test.exe    USB_Test
  </code></pre>
  
  <p>Why I am getting this error? I am using Visual studio 2010 professional. </p>