且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法使用Cmake链接libusb

更新时间:2023-11-10 18:28:58

这实际上是一个链接器错误。它看起来像你可能有libusb-1.0库的错误变量。尝试将您的 target_link_libraries 命令更改为:

This is indeed a linker error. It looks like you might have the wrong variable for the libusb-1.0 libraries. Try changing your target_link_libraries command to:

target_link_libraries(run_tld tld LKTracker ferNN tld_utils servo ${LIBUSB_1_LIBRARIES} ${OpenCV_LIBS})

你可能也应该删除 SET(CMAKE_CXX_FLAGS-lusb-1.0),因为链接将由 target_link_libraries 命令处理。

You probably also should remove SET(CMAKE_CXX_FLAGS "-lusb-1.0"), since linking will be handled by the target_link_libraries command.