Setting up ROS package in CLion

boon picture boon · Oct 16, 2015 · Viewed 8.4k times · Source

I am using CLion (C++ IDE) for editing a ROS package. I was able to open a package by opening the CMakeLists.txt file. But, I get an error,

"FATAL_ERROR "find_package(catkin) failed. catkin was neither found in the workspace nor in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was sourced before"

How do I solve this problem? Will I be able to make the project in CLion (If so, how do I) after I make changes to the code or do I have to catkin_make in a separate terminal?

Answer

WillC picture WillC · Feb 2, 2016

Try this (for Linux):

  1. Open a command line

  2. Run catkin_make on your package.

  3. source your catkin_workspace/devel/setup.bash file e.g. source ~/my_dev_folder/catkin_ws/devel/setup.bash

  4. Start CLion from [CLion install dir]/bin/clion.sh e.g. cd ~/Downloads/clion-1.2.4/bin && ./clion.sh

CLion should then start with knowledge about the packages in your catkin workspace, through the local environment variables set up by the setup.bash file.