Skip to content
This repository was archived by the owner on Jan 23, 2024. It is now read-only.
Tim edited this page Oct 24, 2017 · 6 revisions

Getting started with JetBrains CLion in catkin

Why use CLion?

In the end it's a matter of choice, but if you need justification:

  • Some people (me, for example) like it more than Eclipse
  • Seems to have much faster indexing / overall experience than Eclipse
  • Crashes less often, handles a lot of opened files faster
  • Works very good with Python, too (PyCharm is integrated)
  • Very good out-of-the box git integration

Downloading and launching

  1. Download and install the latest CLion from jetbrains
  2. You need to launch CLion with your workspace environment sourced, no idea if unity buttons can be automated to do that:
cd <YOUR_JETBRAINS_INSTALL_DIR>
. ~/catkin_ws/devel/setup.bash
./bin/qtcreator

(Alternative solution would be to add source ~/catkin_ws/devel/setup.bash to the end of ~/.bashrc.)

  1. Edit Qt desktop file so that it doesn't have to be launched from terminal every time (more info - http://wiki.ros.org/IDEs#QtCreator)
$ cat /usr/share/applications/DigiaQt-qtcreator-community.desktop
[Desktop Entry]
Type=Application
Exec=bash -i -c /opt/Qt5.7.0/Tools/QtCreator/bin/qtcreator
Name=Qt Creator (Community)
GenericName=The IDE of choice for Qt development.
Icon=QtProject-qtcreator
Terminal=false
Categories=Development;IDE;Qt;
MimeType=text/x-c++src;text/x-c++hdr;text/x-xsrc;application/x-designer;application/vnd.qt.qmakeprofile;application/vnd.qt.xml.resource;text/x-qml;text/x-qt.qml;text/x-qt.qbs;

You should not try to generate this file yourself, but rather modify the file that was created when you installed QtCreator. Normally in Ubuntu, this file resides in /usr/share/applications if you did a system wide installation or in ~/.local/share/applications if you installed it only for your user. Use this standard QtCreator desktop file, and in the Exec line add bash -i -c. This will run your QtCreator in a shell which should source all required setup.bash files of your ros installation and workspace. More about desktop files and their locations for Ubuntu can be found here. Note also that the same trick can be used with eclipse.

Opening catkin packages (remember to source devel/setup.bash)

Headers not shown at first

Since the files shown in project view are only CMake dependencies, the headers will not show up at first. Add them by adding the following to the CMakeLists, then right-click the project and Run CMake again:

#############
# QTCREATOR #
#############
FILE(GLOB_RECURSE LibFiles "include/*")
add_custom_target(headers SOURCES ${LibFiles})

Solarized colorscheme

Arguably one of the best color schemes:

TODO

Google Code-Style

Clone this wiki locally