我想在Ubuntu 12.04下使用hidapi庫。我已經按照github中的教程,但是,甚至沒有它的測試代碼正在工作。它總是抱怨未定義的參考。我找不到任何解決方案。即使在安裝成功後,我也無法在任何位置找到該庫。Hidapi無法編譯任何代碼在Ubuntu下
我試圖編譯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朱諾
你能發佈錯誤日誌嗎?這會很有用 – lucasg 2013-03-15 13:40:30
你是從項目根目錄運行'make'還是在'hidtest'目錄下調用'Makefile'? – jazzbassrob 2013-03-15 13:59:15
你的源碼有#include「hidapi.h」 – TheMathemagician 2013-03-15 14:00:11