ubuntu By not providing “Findcatkin.cmake“ in CMAKE_MODULE_PATH this project has asked CMake to fi
ubuntu By not providing "Findcatkin.cmake" in CMAKE_MODULE_PATH this project hasasked CMake to find a package configuration file provided by "catkin", butCMake did not find one.使用CLion编译工程时报错解决新的改变三级标
·
ubuntu By not providing "Findcatkin.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "catkin", but CMake did not find one.
Ubuntu使用CLion编译工程时报错
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
genmsg
)
按上面CMakeLists编译时报错:
CMake Error at CMakeLists.txt:6 (find_package):
By not providing "Findcatkin.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "catkin", but
CMake did not find one.
Could not find a package configuration file provided by "catkin" with any
of the following names:
catkinConfig.cmake
catkin-config.cmake
Add the installation prefix of "catkin" to CMAKE_PREFIX_PATH or set
"catkin_DIR" to a directory containing one of the above files. If "catkin"
provides a separate development package or SDK, be sure it has been
installed.
解决
提示找不到catkin,如果ROS正确安装,应该是ROS环境没有被正确加载。
1. 检查~/.bashrc文件
使用sudo gedit ~/.bashrc
命令打开~/.bashrc文件,查看其中是否有:source /opt/ros/melodic/setup.bash
和你当前工作空间的setup.bash这两行,因为每次打开一个终端会自动运行~/.bashrc文件,而这两行分别是用来加载ROS环境和当前工作空间环境的。
2. 检查CLion是否是用终端打开的
如果CLion是用快捷方式或是从边栏或是直接点击CMakeLists文件打开的,则不会运行终端,自然也不会运行~/.bashrc文件,所以CLion会找不到catkin。建议使用命令行打开CLion
更多推荐
所有评论(0)