我正在尝试在 Ubuntu 12.04 下使用 hidapi 库。我已经按照 github 中的教程进行操作,但是,即使它附带的测试代码也无法正常工作。它总是抱怨未定义的引用。我找不到任何解决方案。即使安装成功,我也无法在任何地方找到该库。
我正在尝试编译 hidtest.cpp,第一个错误在该hid_init()
行中。
有人可以帮助我吗?
编辑:
make all
Building target: hidtest
Invoking: Cross G++ Linker
g++ -o "hidtest" ./src/hidtest.o
./src/hidtest.o: In function `main':
/../src/hidtest.cpp:35: undefined reference to `hid_init'
/../src/hidtest.cpp:38: undefined reference to `hid_enumerate'
/../src/hidtest.cpp:53: undefined reference to `hid_free_enumeration'
/../src/hidtest.cpp:63: undefined reference to `hid_open'
/../src/hidtest.cpp:71: undefined reference to `hid_get_manufacturer_string'
/../src/hidtest.cpp:78: undefined reference to `hid_get_product_string'
/../src/hidtest.cpp:85: undefined reference to `hid_get_serial_number_string'
/../src/hidtest.cpp:93: undefined reference to `hid_get_indexed_string'
/../src/hidtest.cpp:99: undefined reference to `hid_set_nonblocking'
/../src/hidtest.cpp:103: undefined reference to `hid_read'
/../src/hidtest.cpp:111: undefined reference to `hid_send_feature_report'
/../src/hidtest.cpp:120: undefined reference to `hid_get_feature_report'
/../src/hidtest.cpp:123: undefined reference to `hid_error'
/../src/hidtest.cpp:137: undefined reference to `hid_write'
/../src/hidtest.cpp:140: undefined reference to `hid_error'
/../src/hidtest.cpp:146: undefined reference to `hid_write'
/../src/hidtest.cpp:155: undefined reference to `hid_read'
/../src/hidtest.cpp:173: undefined reference to `hid_close'
/../src/hidtest.cpp:176: undefined reference to `hid_exit'
collect2: ld returned 1 exit status
make: *** [hidtest] Error 1
这是在 Ubuntu 12.04 下使用 Eclipse Juno 完成的