Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up ROS package in CLion

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?

like image 538
boon Avatar asked Oct 16 '15 13:10

boon


2 Answers

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.

like image 57
WillC Avatar answered Nov 10 '22 07:11

WillC


To add on to what WillC suggested, you can also modify the desktop entry to start the application from bash instead of manually doing so.

To do this, edit the desktop file located at

~/.local/share/applications/jetbrains-clion.desktop

by modifying the line containing Exec= to

Exec=bash -i -c "/INSTALL_LOCATION/clion-2016.3.2/bin/clion.sh" %f
like image 27
Darren H Avatar answered Nov 10 '22 08:11

Darren H