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

Linking error for message filter

asked 2020-05-05 19:57:46 -0600

Kolohe113 gravatar image

updated 2020-05-05 21:29:11 -0600

When I hit catkin_make I am getting:

 undefined reference to `message_filters::Connection::disconnect()'

Have not idea why this happens, here are my CMakeList.txt and package.xml:

cmake_minimum_required(VERSION 2.8.3)
project(mcl_localization)

## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++11)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  std_msgs
  message_filters
)

catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES mcl_localization
#  CATKIN_DEPENDS roscpp std_msgs
#  DEPENDS system_lib
)

include_directories(
# include
  ${catkin_INCLUDE_DIRS}
  include
)

add_executable(run_mcl src/main.cpp)
target_link_libraries(run_mcl ${catkin_LIBRARIES})

add_library(kdtree src/kdtree.cpp)
add_library(get_map src/get_map.cpp)
add_library(mclcpp src/mcl.cpp)
add_library(mclsub src/mcl_sub.cpp)

target_link_libraries(get_map kdtree)
target_link_libraries(mclcpp mclsub)
target_link_libraries(run_mcl kdtree)
target_link_libraries(run_mcl get_map)
target_link_libraries(run_mcl mclcpp)
target_link_libraries(run_mcl mclsub)

and in my package.xml

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_export_depend>roscpp</build_export_depend>
  <build_export_depend>std_msgs</build_export_depend>
  <exec_depend>roscpp</exec_depend>
  <exec_depend>std_msgs</exec_depend>
  <build_depend>message_filters</build_depend>
  <build_export_depend>message_filters</build_export_depend>
  <exec_depend>message_filters</exec_depend>

I thought I have linked message_filters but apparently not. Any help will be appreciated, thank you.

Edit: Also, my message_filter is located in mcl_sub.cpp, and the node executable is in main.cpp. I tried using the message_filter in main.cpp and it runs. So weird.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-05-05 21:32:14 -0600

Kolohe113 gravatar image

updated 2020-05-05 21:32:34 -0600

So it turns out that I need the target_link_libraries(mclsub ${catkin_LIBRARIES})in cmakelist.txt

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-05-05 19:57:46 -0600

Seen: 443 times

Last updated: May 05 '20