Use 3rd party library with ROS Groovy & C++
Hi, I've been doing some research and though I found similar questions their solutions didn't work for me. I am having trouble with compiling my project while using a 3rd party library. I have the .h and the .o files for the library, but that developer is not currently able to give me the .cpp file.
I am a bit confused as to where exactly to put the .h and .o files and what to put in the CMakeLists file. libfile.h and libfile.o represent the 3rd party library files.
Currently I have both of these files in catkin_ws/src/mypackage/include/mypackage/ In my project code I have an include:
#include "mypackage/libfile.h"
In my CMakeLists.txt file I have:
#include_directories(include
${catkin_INCLUDE_DIRS}
)
add_executable(mypackage src/mypackage_code.cpp)
target_link_libraries(mypackage
${libfile}
${catkin_LIBRARIES}
)
When I do a catkin_make I get a lot of undefined reference to function errors in my project code referencing from this library that I believe are because catkin isn't linking to the other library, like:
mypackage_code.cpp:(.text.startup+0x33a): undefined reference to 'some_function_in_3rdparty_library'
I've tried to only paste the information relevant to this issue to help others. If you want more specifics that's no problem. Thank you very much for your help.
How do you set the value of
libfile
? Is it an absolute path?I tried to make this question easier to understand, I guess that backfired. "libfile" here is just the name of my particular library, (RoboPiLib), with the header/object files RoboPiLib.h & RoboPiLib.o
If that didn't answer your question, how should I define libfile? With link_directories(path)?