Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

Installing and Configuring CLion

Isha Dijcks edited this page Oct 29, 2018 · 42 revisions

For working with this project, CLion is our recommended IDE and the one used by the developers. The free community edition has all the tools needed to contribute to this project.
You are welcome to use any IDE you want, but we won't be available for troubleshooting if you have any problems with it. If you are convinced another IDE is superior in any way, feel free to write an installation guide for that IDE.

Install CLion

  • Download CLion and install.

  • Install compiler

    • Open CLion.
    • ctrl + alt + s (open settings).
    • Search for: toolchains.
    • Select "MinGW" as environment.
    • This is probably not installed, download and install this, restart CLion after the installation.
    • If the path is not correct set this path to MinGW (this probably looks like C:\Program Files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32 )
  • Test if CLion and C++ work by creating and running a new project:

    • Select in the top menu File → New project → C++ Executable.
    • Click Create.
    • In the bottom of the screen you see every thing loading.
    • After this is done (without any errors) select in the top menu Run → Run.

If there are no errors and the run is successful, everything is set-up correctly!

Installing the Hatchery Plugin

It is advised to install the Hatchery Plugin as it has ROS support.
You can install Hatchery directly through the IDE, via File | Settings | Plugins | Search for "hatchery".

Setup auto-formatting in CLion

  • Install clang-format with sudo apt-get install -y clang-format-3.8.
  • Go to File->Preferences->Plugins and search for ClangFormatIJ. Install this plugin. It installs the context menu to invoke locally installed clang-format for a file or for a selection.
  • Go to Tools->clang-format and change the clang-format-binary to clang-format-3.8.
  • Go to Keymap->Plugins->ClangFormatIJ->Reformat Code with clang-format and setup a keyboard shortcut.

Your code is now properly formatted when you trigger your shortcut!

Set copyright header

  • Settings -> Editor -> File and Code Templates
  • Select Scheme: Project
  • Go to the Includes tab and select the C File Header
  • Set the following code:
#if ($HEADER_COMMENTS)
// Copyright $YEAR Project March.
#end
  • Apply and click OK
Clone this wiki locally