ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

CLion IDE can be conveniently used with ros2. It happens thanks to CLion support of Compilation Database (CD) and colcon creating a top-level CD file for the entire workspace. How to set it up?

  1. Build your ros2 project workspace with CMAKE_EXPORT_COMPILE_COMMANDS, e.g. colcon build --symlink-install --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=1.
  2. This creates a compile_commands.json file in your build/ directory. You need to copy it to top-level directory of your workspace (where you have src/ and build/ directories. You can automate this step.
  3. Run your CLion, click File->Open, and select the compile_commands.json file, open it as a project.
  4. Things should work now. To check, hold Ctrl over an object of a class from another workspace package or from your ros2 distro package. You should be able to navigate to definitions with Ctrl-click.

CLion IDE can be conveniently used with ros2. It happens thanks to CLion support of Compilation Database (CD) and colcon creating a top-level CD file for the entire workspace. How Here is how to set it up?up:

  1. Build your ros2 project workspace with CMAKE_EXPORT_COMPILE_COMMANDS, e.g. colcon build --symlink-install --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=1.
  2. This creates a compile_commands.json file in your build/ directory. You need to copy it to top-level directory of your workspace (where you have src/ and build/ directories. You can automate this step.
  3. Run your CLion, click File->Open, and select the compile_commands.json file, open it as a project.
  4. Things should work now. To check, hold Ctrl over an object of a class from another workspace package or from your ros2 distro package. You should be able to navigate to definitions with Ctrl-click.