Linking problems with catkin
Hello, I am trying to migrate code to groovy and have some linking errors with rosconsole, rosserviceserver etc. I think that it is related with target_link_libraries. Could someone help me out with CMakeLists.txt please?
This is the content of CMakeLists.txt:
cmake_minimum_required(VERSION 2.8.3)
project(bertsobot)
find_package(catkin REQUIRED COMPONENTS roscpp std_msgs)
find_package(catkin REQUIRED genmsg)
add_service_files(
DIRECTORY srv
FILES
depth_server.srv
mean_depth_server.srv
)
generate_messages()
catkin_package(DEPENDS roscpp std_msgs opencv2 sensor_msgs cv_bridge image_transport genmsg
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME})
include_directories(include ${Boost_INCLUDE_DIR} ${catkin_INCLUDE_DIRS})
set(CMAKE_VERBOSE_MAKEFILE TRUE)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
add_executable(marisorgin src/main.cpp)
add_executable(depth_server src/depth_server.cpp)
add_executable(mean_depth_server src/mean_depth_server.cpp)
target_link_libraries(marisorgin ${catkin_LIBRARIES})
target_link_libraries(depth_server ${catkin_LIBRARIES})
target_link_libraries(mean_depth_server ${catkin_LIBRARIES})
and this are some of the errors:
...
Linking CXX executable devel/lib/bertsobot/mean_depth_server
/usr/bin/cmake -E cmake_link_script CMakeFiles/mean_depth_server.dir/link.txt --verbose=1
/usr/bin/c++ CMakeFiles/mean_depth_server.dir/src/mean_depth_server.cpp.o -o devel/lib/bertsobot/mean_depth_server -rdynamic
CMakeFiles/mean_depth_server.dir/src/mean_depth_server.cpp.o: In function `get_mean_depth(bertsobot::mean_depth_serverRequest_<std::allocator<void> >&, bertsobot::mean_depth_serverResponse_<std::allocator<void> >&)':
mean_depth_server.cpp:(.text+0x9e): undefined reference to `cvInitLineIterator'
mean_depth_server.cpp:(.text+0x150): undefined reference to `cvGet2D'
mean_depth_server.cpp:(.text+0x287): undefined reference to `ros::console::g_initialized'
mean_depth_server.cpp:(.text+0x297): undefined reference to `ros::console::initialize()'
mean_depth_server.cpp:(.text+0x2e0): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
mean_depth_server.cpp:(.text+0x31b): undefined reference to `ros::console::setLogLocationLevel(ros::console::LogLocation*, ros::console::levels::Level)'
mean_depth_server.cpp:(.text+0x325): undefined reference to `ros::console::checkLogLocationEnabled(ros::console::LogLocation*)'
mean_depth_server.cpp:(.text+0x3c9): undefined reference to `ros::console::print(ros::console::FilterBase*, log4cxx::Logger*, ros::console::levels::Level, char const*, int, char const*, char const*, ...)'
mean_depth_server.cpp:(.text+0x3d0): undefined reference to `ros::console::g_initialized'
mean_depth_server.cpp:(.text+0x3e0): undefined reference to `ros::console::initialize()'
mean_depth_server.cpp:(.text+0x429): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
mean_depth_server.cpp:(.text+0x464): undefined reference to `ros::console::setLogLocationLevel(ros::console::LogLocation*, ros::console::levels::Level)'
mean_depth_server.cpp:(.text+0x46e): undefined reference to `ros::console::checkLogLocationEnabled(ros::console::LogLocation*)'
mean_depth_server.cpp:(.text+0x4d0): undefined reference to `ros::console::print(ros::console::FilterBase*, log4cxx::Logger*, ros::console::levels::Level, char const*, int, char const*, char const*, ...)'
CMakeFiles/mean_depth_server.dir/src/mean_depth_server.cpp.o: In function `imageDepth_callback(boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&)':
mean_depth_server.cpp:(.text+0x59e): undefined reference to `cv_bridge::toCvCopy(boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&, std::string const&)'
mean_depth_server.cpp:(.text+0x646): undefined reference to `ros::console::g_initialized'
mean_depth_server.cpp:(.text+0x656): undefined reference to `ros::console::initialize()'
mean_depth_server.cpp:(.text+0x69f): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
mean_depth_server.cpp:(.text+0x6da): undefined reference to `ros::console::setLogLocationLevel(ros::console::LogLocation*, ros::console::levels::Level)'
mean_depth_server.cpp:(.text+0x6e4): undefined reference to `ros::console::checkLogLocationEnabled(ros::console::LogLocation ...