- 安装boost库
sudo apt-get install libboost-all-dev
安装完之后,库会放在/usr/include/boost目录下
- 修改ros2项目的CMakelist.txt
find_package(Boost 1.71.0 REQUIRED COMPONENTS thread atomic system regex)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
endif()
target_link_libraries(pro_main ${Boost_LIBRARIES})
- 重新编译CMakelist.txt即可