Linking error for message filter
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.