现象
使用rosrun运行程序时,发现无法找到可执行文件,提示信息为:
[rosrun] Couldn't find executable named xxx
原因
CMakeLists.txt
文件中漏写了以下语句:
catkin_package()
ROS关于CMakeLists.txt
的文档catkin/CMakeLists.txt 中提到:
This function must be called before declaring any targets with add_library() or add_executable().
所以补上去就OK了。
其他
这几天会阅读一下上面提到的那个文档,做一下笔记。感觉自己对怎么在CMakeLists.txt
中写ROS需要的东西还是有点模糊。