Setup CLion with ROS
I have some troubles setting up CLion to work properly with ROS (kinteic).
CLion does not recognize my workspace properly thus the IDEs features do not work.
How to setup CLion with ROS?
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
I have some troubles setting up CLion to work properly with ROS (kinteic).
CLion does not recognize my workspace properly thus the IDEs features do not work.
How to setup CLion with ROS?
CLion is a nice tool but for me it did not work out of the box as claimed sometimes. This should be a beginner (primary targeting students) friendly guide on how to use CLion with ROS.
*Note: this how to is tested on Ubuntu 16.04 with CLion 2017.1.3 and 2017.3.2, the process might be different with other versions.
I recommend to check if catkin_make
runs properly in your workspace before you start with this guide. In this way you know CLion is the problem, not ROS.*
.desktop
file, see below).<your workspace path>/src
folder in your workspace<your workspace path>/build
and applyCMakeList.txt
file in CLion and select "Reload CMake Project"CLion should work properly now.
Always start CLion from terminal unless you changed the .desktop
file!
At the restart of CLion the Project will be shown at the recent projects with the name "src".
The project/workspace can be renamed by renaming the <your workspace path>/src/.idea/src.iml
to <your workspace name>.iml
and changing the path to it in <your workspace path>/src/.idea/modules.xml
and by creating a file <your workspace path>/src/.idea/.name
(containging only a name for the project).
cd src/.idea
NEW_NAME=my_workspace
mv src.iml $NEW_NAME.iml
sed -i -e "s/src/$NEW_NAME/g" modules.xml
printf "$NEW_NAME" > .name
If CLion shows you the info "This file does not belong to any project target" right-click the includes
folder an click "Mark Directory as" and select "Project Sources and Headers".
Now you can run and debug from the terminal. This does not work with .launch
files
.launch
files:CLion does not recognize .launch
files as XML files by default.
*.launch
.launch files should now have proper highlighting and autocomplete
.desktop
file:<your home folder>/.local/share/applications
change the according line the .desktop
file for your CLion version to:
Exec=bash -i -c "<clion installation path>/bin/clion.sh" %f
CLion is free for students: students click here
by the way . If you don't wanna build all projects in directory <your workspace path>/src
, you can add -DCATKIN_WHITELIST_PACKAGES="your_pkg1_name;your_pkg2_name"
in CMake options
that located in
File->Settings->Build,Execution,Deployment->CMake
Asked: 2018-03-08 03:38:45 -0600
Seen: 6,868 times
Last updated: Jan 07 '19