Closed VascoSampaio closed 5 years ago
Solved, didn't include usbp-1 in target_link_libraries
I'm glad you figured it out. Ideally, your CMake project should use the libusbp-1.pc file provided by libusbp to determine what linker options to use. This is especially important if you ever compile libusbp as a static library; static libraries cannot record what libraries they depend on, so that information needs to get into your build using some other mechanism like the .pc file.
For an example of a good way to integrate libusbp-1 into a CMake project, see:
https://github.com/pololu/pololu-tic-software/blob/master/lib/CMakeLists.txt
I installed the library as explained in the readme file and had no issues. Used it without problems. Recenntly I tried to build my ROS project (ROS kinetic/Ubuntu 16.04) which includes the libusbp library and I'm getting a compilation error.
CMakeFiles/gimbal_interface_node.dir/src/gimbal_interface_node.cpp.o: In function
libusbp::pointer_free(libusbp_error*)': gimbal_interface_node.cpp:(.text._ZN7libusbp12pointer_freeEP13libusbp_error[_ZN7libusbp12pointer_freeEP13libusbp_error]+0x14): undefined reference to
libusbp_error_free'CMakeFiles/gimbal_interface_node.dir/src/gimbal_interface_node.cpp.o: In function
libusbp::pointer_free(libusbp_device*)': gimbal_interface_node.cpp:(.text._ZN7libusbp12pointer_freeEP14libusbp_device[_ZN7libusbp12pointer_freeEP14libusbp_device]+0x14): undefined reference to
libusbp_device_free'Then there are a couple more undefined reference to other functions.