How to link OpenCV libraries to external .so libraries added in the ROS package ?

asked 2017-12-01 05:58:47 -0600

Prithvi Raj gravatar image

updated 2017-12-01 09:22:13 -0600

mgruhler gravatar image

HI , I have some shared library files .so files put in lib folder of my ROS package to be used along with my ROS node executable . So while Trying catkin_make I am getting following error messages :

../lib/lib1.so: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)
../lib/lib2.so: undefined reference to `cv::Exception::Exception(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
../lib/lib2.so: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
../lib/lib3.so: undefined reference to `vtable for cv::_OutputArray'
../lib/lib3.so: undefined reference to `vtable for cv::_InputArray'**

what i have done in CMakeLists.txt is ,

set(my_LIBRARIES ${PROJECT_SOURCE_DIR}/lib/lib1.so  
                              ${PROJECT_SOURCE_DIR}/lib/lib2.so 
                             ${PROJECT_SOURCE_DIR}/lib/lib3.so)

then in My executable

FIND_PACKAGE(OpenCV REQUIRED)
include_directories(include ${catkin_INCLUDE_DIRS})
include_directories(${OpenCV_INCLUDE_DIRS})
add_executable(exec src/ros_node.cpp )
target_link_libraries(exec ${my_LIBRARIES})
target_link_libraries(exec ${OpenCV_LIBS})
target_link_libraries(exec ${catkin_LIBRARIES})
add_dependencies(exec ${PROJECT_NAME}_gencpp)
add_dependencies(exec ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

Please point me where Am i missing my OpenCV_libs linking to my library(.so) Files .

edit retag flag offensive close merge delete

Comments