Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.

How to setup CLion with ROS (kinetic) [as simple as possible]:

*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.*

  • Start CLion from the terminal to ensure everything is sourced properly. You can alternatively edit the .desktop file, see below).
  • Click "Import Project from Sources"
  • Select the <your workspace path>/src folder in your workspace
  • Click "Open Project" - code editor should open
  • Go to "File" - "Settings" - "Build, Execution, Deployment" - "CMake"
  • Set the generation Path to <your workspace path>/build and apply
  • Finally you should right-click on your top level CMakeList.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". You can change this name by adding a .name (containging only a name for the project) to <your workspace path>/src/.idea.

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".

Setup debugging:

  • Go to "Run" - "Edit Configurations" and click the add button
  • Set a name
  • Select a "Target" and the according "Executable", keep the "Configuration" on Debug and apply

Now you can run and debug from the terminal. This does not work with .launch files

Highlighting in .launch files:

CLion does not recognize .launch files as XML files by default.

  • Go to "File" - "Settings" - "Editor" - "File Types"
  • Search for XML in the recognized files list
  • add *.launch

.launch files should now have proper highlighting and autocomplete

Change the .desktop file:

  • Go to <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

Note:

CLion is free for students: students click here

click to hide/show revision 2
No.2 Revision

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.

How to setup CLion with ROS (kinetic) [as simple as possible]:

*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.*

  • Start CLion from the terminal to ensure everything is sourced properly. You can alternatively edit the .desktop file, see below).
  • Click "Import Project from Sources"
  • Select the <your workspace path>/src folder in your workspace
  • Click "Open Project" - code editor should open
  • Go to "File" - "Settings" - "Build, Execution, Deployment" - "CMake"
  • Set the generation Path to <your workspace path>/build and apply
  • Finally you should right-click on your top level CMakeList.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!

Rename Workspace:

At the restart of CLion the Project will be shown at the recent projects with the name "src". You The project/workspace can change this name be renamed by adding 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 .namefile <your workspace path>/src/.idea/.name (containging only a name for the project) to <your workspace path>/src/.idea.

project).

cd src/.idea
NEW_NAME=my_workspace
mv src.iml $NEW_NAME.iml
sed -i -e 's/src/$NEW_NAME/g'
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".

Setup debugging:

  • Go to "Run" - "Edit Configurations" and click the add button
  • Set a name
  • Select a "Target" and the according "Executable", keep the "Configuration" on Debug and apply

Now you can run and debug from the terminal. This does not work with .launch files

Highlighting in .launch files:

CLion does not recognize .launch files as XML files by default.

  • Go to "File" - "Settings" - "Editor" - "File Types"
  • Search for XML in the recognized files list
  • add *.launch

.launch files should now have proper highlighting and autocomplete

Change the .desktop file:

  • Go to <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

Note:

CLion is free for students: students click here

click to hide/show revision 3
No.3 Revision

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.

How to setup CLion with ROS (kinetic) [as simple as possible]:

*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.*

  • Start CLion from the terminal to ensure everything is sourced properly. You can alternatively edit the .desktop file, see below).
  • Click "Import Project from Sources"
  • Select the <your workspace path>/src folder in your workspace
  • Click "Open Project" - code editor should open
  • Go to "File" - "Settings" - "Build, Execution, Deployment" - "CMake"
  • Set the generation Path to <your workspace path>/build and apply
  • Finally you should right-click on your top level CMakeList.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!

Rename Workspace:Project/Workspace:

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'
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".

Setup debugging:

  • Go to "Run" - "Edit Configurations" and click the add button
  • Set a name
  • Select a "Target" and the according "Executable", keep the "Configuration" on Debug and apply

Now you can run and debug from the terminal. This does not work with .launch files

Highlighting in .launch files:

CLion does not recognize .launch files as XML files by default.

  • Go to "File" - "Settings" - "Editor" - "File Types"
  • Search for XML in the recognized files list
  • add *.launch

.launch files should now have proper highlighting and autocomplete

Change the .desktop file:

  • Go to <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

Note:

CLion is free for students: students click here

click to hide/show revision 4
No.4 Revision

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.

How to setup CLion with ROS (kinetic) [as simple as possible]:

*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.*

  • Start CLion from the terminal to ensure everything is sourced properly. You can alternatively edit the .desktop file, see below).
  • Click "Import Project from Sources"
  • Select the <your workspace path>/src folder in your workspace
  • Click "Open Project" - code editor should open
  • Go to "File" - "Settings" - "Build, Execution, Deployment" - "CMake"
  • Set the generation Path to <your workspace path>/build and apply
  • Finally you should right-click on your top level CMakeList.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!

Rename Project/Workspace:

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'
'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".

Setup debugging:

  • Go to "Run" - "Edit Configurations" and click the add button
  • Set a name
  • Select a "Target" and the according "Executable", keep the "Configuration" on Debug and apply

Now you can run and debug from the terminal. This does not work with .launch files

Highlighting in .launch files:

CLion does not recognize .launch files as XML files by default.

  • Go to "File" - "Settings" - "Editor" - "File Types"
  • Search for XML in the recognized files list
  • add *.launch

.launch files should now have proper highlighting and autocomplete

Change the .desktop file:

  • Go to <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

Note:

CLion is free for students: students click here

click to hide/show revision 5
No.5 Revision

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.

How to setup CLion with ROS (kinetic) [as simple as possible]:

*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.*

  • Start CLion from the terminal to ensure everything is sourced properly. You can alternatively edit the .desktop file, see below).
  • Click "Import Project from Sources"
  • Select the <your workspace path>/src folder in your workspace
  • Click "Open Project" - code editor should open
  • Go to "File" - "Settings" - "Build, Execution, Deployment" - "CMake"
  • Set the generation Path to <your workspace path>/build and apply
  • Finally you should right-click on your top level CMakeList.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!

Rename Project/Workspace:

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' "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".

Setup debugging:

  • Go to "Run" - "Edit Configurations" and click the add button
  • Set a name
  • Select a "Target" and the according "Executable", keep the "Configuration" on Debug and apply

Now you can run and debug from the terminal. This does not work with .launch files

Highlighting in .launch files:

CLion does not recognize .launch files as XML files by default.

  • Go to "File" - "Settings" - "Editor" - "File Types"
  • Search for XML in the recognized files list
  • add *.launch

.launch files should now have proper highlighting and autocomplete

Change the .desktop file:

  • Go to <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

Note:

CLion is free for students: students click here

JetBrains now offers their own instructions on how to setup ROS with CLion: see here


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.

How to setup CLion with ROS (kinetic) [as simple as possible]:

*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.*

  • Start CLion from the terminal to ensure everything is sourced properly. You can alternatively edit the .desktop file, see below).
  • Click "Import Project from Sources"
  • Select the <your workspace path>/src folder in your workspace
  • Click "Open Project" - code editor should open
  • Go to "File" - "Settings" - "Build, Execution, Deployment" - "CMake"
  • Set the generation Path to <your workspace path>/build and apply
  • Finally you should right-click on your top level CMakeList.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!

Rename Project/Workspace:

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".

Setup debugging:

  • Go to "Run" - "Edit Configurations" and click the add button
  • Set a name
  • Select a "Target" and the according "Executable", keep the "Configuration" on Debug and apply

Now you can run and debug from the terminal. This does not work with .launch files

Highlighting in .launch files:

CLion does not recognize .launch files as XML files by default.

  • Go to "File" - "Settings" - "Editor" - "File Types"
  • Search for XML in the recognized files list
  • add *.launch

.launch files should now have proper highlighting and autocomplete

Change the .desktop file:

  • Go to <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

Note:

CLion is free for students: students click here