Wiki

Clone wiki

scl-manips-v2 / configure / CLion

Introduction

JetBrains is a company that makes a family of IDEs for several programming languages. They just released a public preview of their C/C++ editor, called CLion. In my opinion, it beats Eclipse in terms of usability, speed, and looks. But its killer feature for SCL is that it uses CMake as its project model - it records source files, compiler settings, targets description, etc. through CMake files instead of some proprietary format. This means that we can open SCL projects that use CMake and have all code-completion, linked libraries, etc. working out of the box.

This document describes how to set up CLion on Ubuntu and run an SCL tutorial.

Step 1: Download CLion

CLion is currently available from their Early Access Program here. They warn that it's pre-release software, but overall it's already pretty polished. The Early Access Program doesn't require a license. Once they move to a formal release, you can get a free student license by entering your Stanford email at https://www.jetbrains.com/student/.

Download the latest Linux build.

Step 2: Install CLion

Run the following commands:

cd ~/Downloads
tar xvf clion-138.2344.17.tar.gz
sudo mv clion-138.2344.17 /usr/local/
cd /usr/local/clion-138.2344.17/bin/
./clion.sh

A graphical interface should now pop up, letting you install CLion to be run as a desktop application. It should then be in your program menu, and you don't have to start it from the command line.

If you have an issue starting CLion, you might need to install a JDK:

sudo apt-get install openjdk-7-jdk

Step 3: Open a project

Go to File -> Open and select an SCL tutorial folder, like scl_tutorial6_control_humanoid. CLion will open the folder and parse CMakeLists.txt to find source files and libraries. It will then build the index automatically. If you open the .cpp file from the left menu, you will see it is already linked to all the libraries and has code-completion.

To run the project, we just have to set the working directory, because the SCL executable expects resources in its local folder (CLion builds in its own directory by default). Go to Run -> Edit Configurations, set the Working directory as the scl_tutorial6_control_humanoid folder, and hit OK.

Now, hit the green play button in the top right corner to build and run the project!

Additional Notes

CLion has many inspections that offer hints to improve code quality. One which I find annoying is the 'spelling' inspection, which often underlines variables and functions that aren't real words. To turn it off, go to File -> Settings -> Editor -> Inspections and uncheck Spelling.

Updated