ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Linking problems with catkin

asked 2012-11-29 01:22:29 -0600

Oier gravatar image

updated 2014-01-28 17:14:25 -0600

ngrennan gravatar image

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 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2012-11-29 01:38:08 -0600

KruseT gravatar image

Try this:

-find_package(catkin REQUIRED COMPONENTS roscpp std_msgs)
-find_package(catkin REQUIRED genmsg)

+find_package(catkin REQUIRED COMPONENTS roscpp std_msgs genmsg)
edit flag offensive delete link more

Comments

HI, I have the same problem but it doesn't work. Shall I add another package dependency in package.xml file? I use hydro. Thanks

est_CEAR gravatar image est_CEAR  ( 2015-02-18 06:05:29 -0600 )edit

@hb_CEAR: sounds like you have a different problem, if you are asking about package.xml. Please open a new question with details about what you did, and what happened. You can link to this one, if it seems relevant.

joq gravatar image joq  ( 2015-02-18 08:50:41 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2012-11-29 01:22:29 -0600

Seen: 6,226 times

Last updated: Nov 29 '12