I am very new to ROS and C++, and I apologize if my question is obvious.
I have looked over very many questions and answers and tried the code offered by the answers; I looked over the documentation at http://wiki.ros.org/catkin/CMakeLists.txt#Library_Targets; I moved files from /usr/local/lib to /opt/ros/indigo/lib; and I tried very many different lines of code in CMakeLists.txt and I still cannot make my code compile.
I am using Ubuntu 14.04, with Indigo and Catkin as the build tool.
The Error:
jimmy_state_publisher.cpp:(.text+0x310): undefined reference to `LJUSB_OpenDevice'
jimmy_state_publisher.cpp:(.text+0x81b): undefined reference to `LJUSB_Write'
jimmy_state_publisher.cpp:(.text+0x851): undefined reference to `LJUSB_CloseDevice'
jimmy_state_publisher.cpp:(.text+0x876): undefined reference to `LJUSB_Read'
lots more of the same type of error....
I am using a device called 'Labjack U3'. The driver for this device is called exodriver https://labjack.com/support/software/installers/exodriver. I downloaded the driver and installed it. It generated a liblabjackusb.so file in /usr/local/lib. All the undefined reference errors are methods/functions implemented in the driver source file. How do I modify my CMakeLists.txt to allow my only executable (jimmy_state_publisher.cpp) in the ROS package to use the liblabjackusb.so file? What modifications in the CMakeLists.txt file do I need to make for the package to compile?
CMakeLists.txt:
cmake_minimum_required(VERSION 2.8.3)
project(jimmy_v2)
find_package(catkin REQUIRED COMPONENTS roscpp rospy sensor_msgs std_msgs tf)
catkin_package()
include_directories(include ${catkin_INCLUDE_DIRS})
add_executable(jimmy_state_publisher src/jimmy_state_publisher.cpp)
target_link_libraries(jimmy_state_publisher ${catkin_LIBRARIES})
I did #include "labjackusb.h"
in the executable file that I created.
How do I modify the CMakeLists.txt file to take the labjackusb.so file into consideration? or if that is the wrong question, how do I build my project successfully?
If any information that you need is omitted I apologize.... simply let me know what else I need to include.
Thank you in advance.
Originally posted by BuilderMike on ROS Answers with karma: 247 on 2017-10-28
Post score: 0