ros中message_filters编译问题
ros中message_filters编译问题
参考链接: link.
平台 ros melodic
问题描述
CMakeFiles/avoidance_sub.dir/src/avoidance_sub.cpp.o: In function
message_filters::Synchronizer<message_filters::sync_policies::ApproximateTime<geometry_msgs::Vector3Stamped_<std::allocator<void> >, geometry_msgs::Vector3Stamped_<std::allocator<void> >, message_filters::NullType, message_filters::NullType, message_filters::NullType, message_filters::NullType, message_filters::NullType, message_filters::NullType, message_filters::NullType> >::disconnectAll()': avoidance_sub.cpp:(.text._ZN15message_filters12SynchronizerINS_13sync_policies15ApproximateTimeIN13geometry_msgs15Vector3Stamped_ISaIvEEES6_NS_8NullTypeES7_S7_S7_S7_S7_S7_EEE13disconnectAllEv[_ZN15message_filters12SynchronizerINS_13sync_policies15ApproximateTimeIN13geometry_msgs15Vector3Stamped_ISaIvEEES6_NS_8NullTypeES7_S7_S7_S7_S7_S7_EEE13disconnectAllEv]+0x43): undefined reference to
message_filters::Connection::disconnect()’
CMakeFiles/avoidance_sub.dir/src/avoidance_sub.cpp.o: In functionmessage_filters::Connection message_filters::Signal9<geometry_msgs::Vector3Stamped_<std::allocator<void> >, geometry_msgs::Vector3Stamped_<std::allocator<void> >, message_filters::NullType, message_filters::NullType, message_filters::NullType, message_filters::NullType, message_filters::NullType, message_filters::NullType, message_filters::NullType>::addCallback<boost::shared_ptr<geometry_msgs::Vector3Stamped_<std::allocator<void> > const> const&, boost::shared_ptr<geometry_msgs::Vector3Stamped_<std::allocator<void> > const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&>(boost::function<void (boost::shared_ptr<geometry_msgs::Vector3Stamped_<std::allocator<void> > const> const&, boost::shared_ptr<geometry_msgs::Vector3Stamped_<std::allocator<void> > const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&)> const&)': avoidance_sub.cpp:(.text._ZN15message_filters7Signal9IN13geometry_msgs15Vector3Stamped_ISaIvEEES4_NS_8NullTypeES5_S5_S5_S5_S5_S5_E11addCallbackIRKN5boost10shared_ptrIKS4_EESD_RKNS9_IKS5_EESH_SH_SH_SH_SH_SH_EENS_10ConnectionERKNS8_8functionIFvT_T0_T1_T2_T3_T4_T5_T6_T7_EEE[_ZN15message_filters7Signal9IN13geometry_msgs15Vector3Stamped_ISaIvEEES4_NS_8NullTypeES5_S5_S5_S5_S5_S5_E11addCallbackIRKN5boost10shared_ptrIKS4_EESD_RKNS9_IKS5_EESH_SH_SH_SH_SH_SH_EENS_10ConnectionERKNS8_8functionIFvT_T0_T1_T2_T3_T4_T5_T6_T7_EEE]+0x191): undefined reference to
message_filters::Connection::Connection(boost::function<void ()> const&)’
CMakeFiles/avoidance_sub.dir/src/avoidance_sub.cpp.o: In functionmessage_filters::Connection message_filters::SimpleFilter<geometry_msgs::Vector3Stamped_<std::allocator<void> > >::registerCallback<ros::MessageEvent<geometry_msgs::Vector3Stamped_<std::allocator<void> > const> const&>(boost::function<void (ros::MessageEvent<geometry_msgs::Vector3Stamped_<std::allocator<void> > const> const&)> const&)': avoidance_sub.cpp:(.text._ZN15message_filters12SimpleFilterIN13geometry_msgs15Vector3Stamped_ISaIvEEEE16registerCallbackIRKN3ros12MessageEventIKS4_EEEENS_10ConnectionERKN5boost8functionIFvT_EEE[_ZN15message_filters12SimpleFilterIN13geometry_msgs15Vector3Stamped_ISaIvEEEE16registerCallbackIRKN3ros12MessageEventIKS4_EEEENS_10ConnectionERKN5boost8functionIFvT_EEE]+0xba): undefined reference to
message_filters::Connection::Connection(boost::function<void ()> const&)’
collect2: error: ld returned 1 exit status
avoidance/CMakeFiles/avoidance_sub.dir/build.make:113: recipe for target ‘/home/ljn/ROS/avoidance/catkin_ws/devel/lib/avoidance/avoidance_sub’ failed
make[2]: *** [/home/ljn/ROS/avoidance/catkin_ws/devel/lib/avoidance/avoidance_sub] Error 1
CMakeFiles/Makefile2:1592: recipe for target ‘avoidance/CMakeFiles/avoidance_sub.dir/all’ failed
make[1]: *** [avoidance/CMakeFiles/avoidance_sub.dir/all] Error 2
Makefile:140: recipe for target ‘all’ failed
make: *** [all] Error 2
Invoking “make -j4 -l4” failed
解决方法
在CMakeLists.txt中添加
find_package( catkin REQUIRED COMPONENTS
...
message_filters
)
在package.xml文件中添加相关依赖
find_package( catkin REQUIRED COMPONENTS
<build_depend>message_filters</build_depend>
<build_export_depend>message_filters</build_export_depend>
<exec_depend>message_filters</exec_depend>
)
推荐阅读
-
aosp 编译 automotive 中遇到的问题
-
CLion中编译ROS工程的配置详细教程
-
关于res资源文件编译后复制到bin文件中的问题 JavaMEEclipse
-
解决Vue编译时写在style中的路径问题
-
编译php中遇到的问题和解决方法
-
Windows 下 VS code 中 Code Runner 无法输入 & 中文乱码 & 编译报错 等问题解决
-
VS2019编译器__cplusplus仍为199711的问题,及CMAKE中的解决方案
-
macOS 11 Bigsur 中 CLion 编译失败问题
-
layabox2.0命令行在vscode中编译打包问题
-
解决ROS编译安装Opencv项目出现undefined Reference to....问题