Unknown CMake command "rosbuild_add_executable".

I got this error when I try to add ROS to a existing project. To slove this probelm you can check your file in this two ways:

1. Check  File  .bashrc

    TO check whether you current project ROS path is included in ROS_PACKAGE_PATH, for me , I should add below into my file:

export ROS_PACKAGE_PATH= /home/shinan/Project/Learn-ORB-VIO-Stereo-Mono:/home/shinan/Project/Learn-ORB-VIO-Stereo-Mono/Examples/ROS

2. Check your current CMakeLIsts.txt

   TO check that before you use rosbuild_add_executable, did you add ?

include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
rosbuild_init()

These two line should in the beginning of your file right just after cmake_minimum_required().

WHY:  To use any of the ROS macros, you must first do this:

include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

This line brings in the rosbuild.cmake file, which defines the macros described below.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章