在使用gtsam的时候出现问题:
[ERROR] [1712107483.937877766]: Failed to load nodelet [/globalmap_server_nodelet] of type [hdl_localization/GlobalmapServerNodelet] even after refreshing the cache: Failed to load library /home/robot/catkin_ws/devel/lib//libglobalmap_server_nodelet.so. Make sure that you are calling the PLUGINLIB_EXPORT_CLASS macro in the library code, and that names are consistent between this macro and your XML. Error string: Could not load library (Poco exception = /home/robot/catkin_ws/devel/lib//libglobalmap_server_nodelet.so: undefined symbol: _ZTVN5gtsam19GaussianFactorGraphE)
[ERROR] [1712107483.937907728]: The error before refreshing the cache was: Failed to load library /home/robot/catkin_ws/devel/lib//libglobalmap_server_nodelet.so. Make sure that you are calling the PLUGINLIB_EXPORT_CLASS macro in the library code, and that names are consistent between this macro and your XML. Error string: Could not load library (Poco exception = /home/robot/catkin_ws/devel/lib//libglobalmap_server_nodelet.so: undefined symbol: _ZTVN5gtsam19GaussianFactorGraphE)
[FATAL] [1712107483.938048249]: Failed to load nodelet '/globalmap_server_nodelet` of type `hdl_localization/GlobalmapServerNodelet` to manager `hdl_nodelet_manager'
解决方法:
在cmakelist的target_link_libraries里面添加gtsam,
貌似前面的那个GTSAM_LIBRARY_DIRS 没卵用,有可能是写错了
add_library(globalmap_server_nodelet apps/globalmap_server_nodelet.cpp)
target_link_libraries(globalmap_server_nodelet
${catkin_LIBRARIES}
${PCL_LIBRARIES}
${OpenCV_LIBRARY_DIRS}
${GTSAM_LIBRARY_DIRS}
gtsam
${glog_LIBRARY_DIRS}
)