title: Unable to compile a4tech-bloody-linux-driver on Linux Mint 18, nor Ubuntu 16.04
body: <p>Since I bought A4Tech Bloody V8 mouse, I would like to install the driver for Linux, specifically for Linux Mint 18 (Ubuntu 16.04 based).</p>
  
  <p>I found this driver on GitHub:</p>
  
  <p><a href="https://github.com/maxmati/a4tech-bloody-linux-driver" rel="nofollow noreferrer">https://github.com/maxmati/a4tech-bloody-linux-driver</a></p>
  
  <hr>
  
  <p>Since there is no documentation as for how to install it, so far I figured out how to prepare it for compilation:</p>
  
  <p>First I installed <code>cmake</code>:</p>
  
  <pre><code>sudo apt-get install cmake
  </code></pre>
  
  <p>Then I prepared it for <code>make</code> as follows:</p>
  
  <pre><code>cmake .
  </code></pre>
  
  <p>I attach the output for future reference, but I don't see any error there:</p>
  
  <pre><code>-- The C compiler identification is GNU 5.4.0
  -- The CXX compiler identification is GNU 5.4.0
  -- Check for working C compiler: /usr/bin/cc
  -- Check for working C compiler: /usr/bin/cc -- works
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Check for working CXX compiler: /usr/bin/c++
  -- Check for working CXX compiler: /usr/bin/c++ -- works
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /home/vlastimil/Downloads/a4tech-bloody-linux-driver-master
  </code></pre>
  
  <hr>
  
  <p>I have tried to do all of the steps suggested on this issue page: <a href="https://github.com/maxmati/a4tech-bloody-linux-driver/issues/10" rel="nofollow noreferrer">https://github.com/maxmati/a4tech-bloody-linux-driver/issues/10</a></p>
  
  <p>But when running this:</p>
  
  <pre><code>rm CMakeCache.txt &amp;&amp; cmake . &amp;&amp; make clean &amp;&amp; make
  </code></pre>
  
  <p>I get these errors:</p>
  
  <pre><code>Scanning dependencies of target bloody
  [ 33%] Building CXX object CMakeFiles/bloody.dir/main.cpp.o
  [ 66%] Building CXX object CMakeFiles/bloody.dir/Mouse.cpp.o
  [100%] Linking CXX executable bloody
  CMakeFiles/bloody.dir/Mouse.cpp.o: In function `Mouse::init()':
  Mouse.cpp:(.text+0x18): undefined reference to `libusb_init'
  Mouse.cpp:(.text+0x64): undefined reference to `libusb_set_debug'
  CMakeFiles/bloody.dir/Mouse.cpp.o: In function `Mouse::discoverDevices()':
  Mouse.cpp:(.text+0xa5): undefined reference to `libusb_get_device_list'
  Mouse.cpp:(.text+0x10a): undefined reference to `libusb_get_device_descriptor'
  Mouse.cpp:(.text+0x14c): undefined reference to `libusb_open'
  Mouse.cpp:(.text+0x16e): undefined reference to `libusb_kernel_driver_active'
  Mouse.cpp:(.text+0x18d): undefined reference to `libusb_detach_kernel_driver'
  Mouse.cpp:(.text+0x1a6): undefined reference to `libusb_close'
  Mouse.cpp:(.text+0x1cc): undefined reference to `libusb_get_device_address'
  Mouse.cpp:(.text+0x215): undefined reference to `libusb_free_device_list'
  CMakeFiles/bloody.dir/Mouse.cpp.o: In function `Mouse::~Mouse()':
  Mouse.cpp:(.text+0x366): undefined reference to `libusb_close'
  Mouse.cpp:(.text+0x391): undefined reference to `libusb_exit'
  CMakeFiles/bloody.dir/Mouse.cpp.o: In function `Mouse::writeToMouse(unsigned char*, unsigned long)':
  Mouse.cpp:(.text+0x497): undefined reference to `libusb_control_transfer'
  CMakeFiles/bloody.dir/Mouse.cpp.o: In function `Mouse::readFromMouse(unsigned char*, unsigned long, unsigned char*, unsigned long)':
  Mouse.cpp:(.text+0x548): undefined reference to `libusb_control_transfer'
  CMakeFiles/bloody.dir/Mouse.cpp.o: In function `Mouse::listDevices()':
  Mouse.cpp:(.text+0x6af): undefined reference to `libusb_get_device'
  Mouse.cpp:(.text+0x6c6): undefined reference to `libusb_get_device_descriptor'
  collect2: error: ld returned 1 exit status
  CMakeFiles/bloody.dir/build.make:120: recipe for target 'bloody' failed
  make[2]: *** [bloody] Error 1
  CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/bloody.dir/all' failed
  make[1]: *** [CMakeFiles/bloody.dir/all] Error 2
  Makefile:83: recipe for target 'all' failed
  make: *** [all] Error 2
  </code></pre>
  
  <hr>
  
  <pre><code>locate libusb.h
  </code></pre>
  
  <p>tells me, that it exists in:</p>
  
  <pre><code>/usr/include/libusb-1.0/libusb.h
  </code></pre>
  
  <p>but trying to manually compile it with <code>g++</code>:</p>
  
  <pre><code>g++ main.cpp -lusb-1.0
  </code></pre>
  
  <p>says, it did not find it:</p>
  
  <pre><code>In file included from main.cpp:2:0:
  Mouse.h:8:20: fatal error: libusb.h: No such file or directory
  compilation terminated.
  </code></pre>
  
  <p>Confusing.</p>
  
  <hr>
  
  <p>List of files generated looks well:</p>
  
  <pre><code>ll
  
  total 124K
  -rw-r--r-- 1 vlastimil vlastimil 6.3K Nov 17 15:25 build.make
  -rw-r--r-- 1 vlastimil vlastimil  276 Nov 17 15:25 cmake_clean.cmake
  -rw-r--r-- 1 vlastimil vlastimil  551 Nov 17 15:25 CXX.includecache
  -rw-r--r-- 1 vlastimil vlastimil  799 Nov 17 15:25 DependInfo.cmake
  -rw-r--r-- 1 vlastimil vlastimil  445 Nov 17 15:25 depend.internal
  -rw-r--r-- 1 vlastimil vlastimil  274 Nov 17 15:25 depend.make
  -rw-r--r-- 1 vlastimil vlastimil  255 Nov 17 15:25 flags.make
  -rw-r--r-- 1 vlastimil vlastimil  182 Nov 17 15:25 link.txt
  -rw-r--r-- 1 vlastimil vlastimil 9.9K Nov 17 15:25 main.cpp.o
  -rw-r--r-- 1 vlastimil vlastimil  69K Nov 17 15:25 Mouse.cpp.o
  -rw-r--r-- 1 vlastimil vlastimil   64 Nov 17 15:25 progress.make
  </code></pre>
  
  <p>I am just unable to link them together into a binary file, I tried it directly:</p>
  
  <pre><code>/usr/bin/g++ -std=c++11 -I/usr/include/libusb-1.0 -L/usr/lib/x86_64-linux-gnu -lusb-1.0 main.cpp.o Mouse.cpp.o -o bloody
  
  Mouse.cpp.o: In function `Mouse::init()':
  Mouse.cpp:(.text+0x18): undefined reference to `libusb_init'
  Mouse.cpp:(.text+0x64): undefined reference to `libusb_set_debug'
  Mouse.cpp.o: In function `Mouse::discoverDevices()':
  Mouse.cpp:(.text+0xa5): undefined reference to `libusb_get_device_list'
  Mouse.cpp:(.text+0x10a): undefined reference to `libusb_get_device_descriptor'
  Mouse.cpp:(.text+0x14c): undefined reference to `libusb_open'
  Mouse.cpp:(.text+0x16e): undefined reference to `libusb_kernel_driver_active'
  Mouse.cpp:(.text+0x18d): undefined reference to `libusb_detach_kernel_driver'
  Mouse.cpp:(.text+0x1a6): undefined reference to `libusb_close'
  Mouse.cpp:(.text+0x1cc): undefined reference to `libusb_get_device_address'
  Mouse.cpp:(.text+0x215): undefined reference to `libusb_free_device_list'
  Mouse.cpp.o: In function `Mouse::~Mouse()':
  Mouse.cpp:(.text+0x366): undefined reference to `libusb_close'
  Mouse.cpp:(.text+0x391): undefined reference to `libusb_exit'
  Mouse.cpp.o: In function `Mouse::writeToMouse(unsigned char*, unsigned long)':
  Mouse.cpp:(.text+0x497): undefined reference to `libusb_control_transfer'
  Mouse.cpp.o: In function `Mouse::readFromMouse(unsigned char*, unsigned long, unsigned char*, unsigned long)':
  Mouse.cpp:(.text+0x548): undefined reference to `libusb_control_transfer'
  Mouse.cpp.o: In function `Mouse::listDevices()':
  Mouse.cpp:(.text+0x6af): undefined reference to `libusb_get_device'
  Mouse.cpp:(.text+0x6c6): undefined reference to `libusb_get_device_descriptor'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <hr>
  
  <p>I am wondering if it could be the linker's error (?)</p>
  
  <hr>
  
  <p>The last idea I had was to link those two object files together:</p>
  
  <pre><code>g++ -o output main.cpp.o Mouse.cpp.o
  </code></pre>
  
  <p>But that ended up the same as above direct attempt.</p>
  
  <hr>
  
  <p>Compiler version is:</p>
  
  <pre><code>g++-5.real (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
  </code></pre>
  
  <hr>
  
  <p>I don't know how to proceed further. Thank you for any hints.</p>