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

Revision history [back]

click to hide/show revision 1
initial version

As has been mentioned in several of the comments, using CLion requires building with cmake directly rather than through Catkin. This is off the "garden path" for both CLion and Catkin, so user beware.

That being said.... we found a way that works for us. Usually. When the stars are aligned. From a clean checkout of your intended workspace:

  1. Run catkin_make like you normally would
  2. Run source devel/setup.bash to load the workspace's environment variables correctly. Also like would when regularly using catkin.
  3. Start CLion from the same terminal you just sourced that setup.bash in in order to start CLion with the right environment variables
  4. Import the workspace's src/CMakeLists.txt as an existing CMake project
  5. Under project settings, change
  6. Generation Path to ../build
  7. CMake options to -DCATKIN_DEVEL_PREFIX:PATH=/path/to/your/workspace_ws/devel

It's definitely dodgy though, and does not work well with the catkin tool at all. When in doubt, wipe your build and devel directories and start over using regular catkin_make outside of CLion.

Still, this technique does mostly work (as of Jan 2018) and CLion is a very powerful tool when hacking on ROS stuff.

For those interested, I created an issue with the CLion dev team here: https://youtrack.jetbrains.com/issue/CPP-7438 It was unceremoniously closed with a "we have no plans to support etc" statement. Despite four "oh yeah, that'd be great!" comments.

As has been mentioned in several of the comments, using CLion requires building with cmake directly rather than through Catkin. This is off the "garden path" for both CLion and Catkin, so user beware.

That being said.... we found a way that works for us. Usually. When the stars are aligned. From a clean checkout of your intended workspace:

  1. Run catkin_make like you normally would
  2. Run source devel/setup.bash to load the workspace's environment variables correctly. Also like would when regularly using catkin.
  3. Start CLion from the same terminal you just sourced that setup.bash in in order to start CLion with the right environment variables
  4. Import the workspace's src/CMakeLists.txt as an existing CMake project
  5. Under project settings, change
  6. Generation Path to ../build
  7. CMake options to -DCATKIN_DEVEL_PREFIX:PATH=/path/to/your/workspace_ws/devel

It's definitely dodgy though, and does not work well with the catkin tool at all. When in doubt, wipe your build and devel directories and start over using regular catkin_make outside of CLion.CLion. It helps to think of it like "making CLion load catkin projects" rather than "use CLion to build catkin projects."

Still, this technique does mostly work (as of Jan 2018) and CLion is a very powerful tool when hacking on ROS stuff.

For those interested, I created an issue with the CLion dev team here: https://youtrack.jetbrains.com/issue/CPP-7438 It was unceremoniously closed with a "we have no plans to support etc" statement. Despite four "oh yeah, that'd be great!" comments.

As has been mentioned in several of the comments, using CLion requires building with cmake directly rather than through Catkin. This is off the "garden path" for both CLion and Catkin, so user beware.

That being said.... we found a way that works for us. Usually. When the stars are aligned. From a clean checkout of your intended workspace:

  1. Run catkin_make like you normally would
  2. Run source devel/setup.bash to load the workspace's environment variables correctly. Also like would when regularly using catkin.
  3. Start CLion from the same terminal you just sourced that setup.bash in in order to start CLion with the right environment variables
  4. Import the workspace's src/CMakeLists.txt as an existing CMake project
  5. Under project settings, change
  6. Generation Path to ../build
  7. CMake options to -DCATKIN_DEVEL_PREFIX:PATH=/path/to/your/workspace_ws/devel

It's definitely dodgy though, and does not work well with the catkin tool at all. When in doubt, wipe your build and devel directories and start over using regular catkin_make outside of CLion. It helps to think of it like "making CLion load catkin projects" rather than "use CLion to build catkin projects."

Still, this technique does mostly work (as of Jan 2018) and CLion is a very powerful tool when hacking on ROS stuff.

For those interested, I created an issue with the CLion dev team here: and it was closed as a duplicate of: https://youtrack.jetbrains.com/issue/CPP-7438 It was unceremoniously closed with a ... with a comment that "we have no plans to support etc" statement. Despite four "oh yeah, that'd be great!" comments.

...etc"

There are many versions of this approach scattered around the Internet; this is just the one that seems to work for us, on Ubuntu 16.04 / ROS-Kinetic, this week.