我正在嘗試將攝像頭(非uvc)流程序傳輸到ros平臺。如何解決在ros中'未定義的引用libusb'錯誤?
我已經有了運行攝像頭的驅動
和Makefile是這樣的:
g++ main.cpp -o test_gui -g -I /usr/local/include -L /usr/local/lib -D_LIN -D_DEBUG -L../lib/x64 -I../include -lASICamera -lpthread -lusb -DGLIBC_20 -m64 -lrt -I/opt
現在,我想這樣做的ROS節點,所以我寫的其中CMakelists是這樣一個節點:
include_directories(
${catkin_INCLUDE_DIRS}
)
include_directories(/usr/local/include)
include_directories(/root/catkin_ws/src/asi_converter_real/include/asi_converter_real)
link_directories(/usr/local/lib)
link_libraries(pthread)
link_libraries(usb)
link_libraries(libASICamera.a)
link_libraries(libASICamera.so)
add_executable(asi_converter_real src/asi_converter_real.cpp)
target_link_libraries(asi_converter_real ${catkin_LIBRARIES})
而且Makefile行生成到/ catkin_ws /編譯/ *** /是這樣的:
/usr/bin/c++ CMakeFiles/asi_converter_real.dir/src/asi_converter_real.cpp.o -o /root/catkin_ws/devel/lib/asi_converter_real/asi_converter_real -rdynamic -L/usr/local/lib -lpthread -lusb -Wl,-Bstatic -lASICamera -Wl,-Bdynamic -lASICamera
但似乎系統無法找到動態庫libusb,因爲它報告
undefined reference to `libusb_set_configuration'
undefined reference to `libusb_claim_interface'
/usr/local/lib/libASICamera.a(ASI174MM.o): In function `WorkingFunc(void*)':
undefined reference to `libusb_bulk_transfer'
undefined reference to `libusb_bulk_transfer'
[1]有沒有人知道如何解決這個問題?
[2]如何在我的電腦中找到libusb的.a和.so。 (我相信我有他們,因爲我可以pkg-config --cflags/- 庫他們)
[3]我如何明確鏈接ros CMakelists動態庫?或者只是link_libraries(usb)足夠用於靜態和動態libriries?
它可以正常工作!!!!!!!! thx leiaz,我愛pkg_search_module !!!!!!!!! – 2014-11-25 11:46:12