The time has come when I decided to change my default operating system from Windows to Linux (Ubuntu, to be more precise). There were few reasons I did it, but I’m not going to write about them right now. Right now I want to write about my search for the perfect C++ IDE for Linux.

There is a really old joke: “The best program to write C++ in Linux is the Linux itself”. It is well known that hardcore developers write code in Vim, build it by typing compiler’s commands by hand and use GDB in terminal to debug. But I’ve become lazy because of Windows and I really like to have slick and easy to use IDE such as Visual Studio, which… is not available on Linux, unfortunatelly.

I was looking for something similar to the Visual Studio which I’ve got used to. For me – a good IDE should let the programmer focus on programming not on fighting with building pipeline and tons of configurations. Having this in mind, from many IDEs available, I’ve selected few worth mentioning.

CMake

Ok, I’ve been writing that we should not getting bothered by building the pipeline but after checking some of the candidates it became clear that almost all of them heavily depends on the CMake. So if you are a C++ developer and you still somehow don’t know how to use CMake… this is the best moment to learn it. Not only for coding in Linux though – CMake is an amazing tool, which opens many doors to automatization, cross platform distribution and continous delivery.

Code::Blocks

codeblocks2

This IDE has a rally strong Visual Studio vibes. Creating a new project takes only few clicks, there are no extra steps needed for setting up a compiler and debugger. By default it uses GCC and GDB. It automatically runs compiler’s commands and attaches the debugger to the process. Adding new files and static libraries is dealt like in Visual Studio – by the project manager and project properties. The key bindings are weird for me but this is the matter of getting used to it (or rebinding them in options).

However, I can’t get rid of this strange feeling when I use Code::Blocks that it lacks of polish. Syntax suggestion sometimes doesn’t work as expected, debugging windows can’t be stacked together, changing theme to dark is complicated, there is no built-in version control… these are small, but irritating issues.

But still, this is the best free Visual Studio-like IDE on Linux.

CLion

pobraneThe CLion is the IDE made by JetBrains, the same studio that brought to us PyCharm, Rider, IntelliJ and more. If you’ve been using any of the JetBrains applications it will feel like home. It has the same key bindings, the same window layout and the same way of navigating through code.

Starting a new project is really easy, only few clicks and everything is set up.

The code suggestion works fantastic. It has many options for refactoring and quick code generation with code snippets. It has a lot of built-in tools and it has Valgrind and Version Control Systems integration. Moving through the project is a pleasure with quick definition peeking, switching between definition and declaration and fast opening the included files. When debugging you can see variables’ values in quick  preview. What is the most amazing – everything works perfectly smooth!

CLion uses CMake for managing and building the project, so it is highly recommendet to have a knowledge about this concept. But, if you are not familiar with CMake – the CLion can take care of modifying the CMake script file if you will use built-in options for adding new classes.

CLion is a powerful IDE that has absolutely everything needed for professional C++ development. There is even a plugin integrating it with Unreal Engine 4 so it can be used for making awesome games!

Unfortunately – the quality comes with the price of about 90 euros per year for personal usage. But still – if you are thinking about serious C++ development in Linux (and not only) this is the best program you can get.

Visual Studio Code

54025The VS Code is a strange entity. Actually, it is not the IDE but it is such an interesting piece of software, that I’ve decided to look at this closer… and I felt in love with it!

VS Code is a highly scriptable text editor such as Sublime or Atom, which can be extended by plugins. With some work it can be transformed into lightweight IDE for C++ with building system based on CMake, code suggestion powered by Intellisence and graphical debugging attached to the GDB.

The plugins I use are called: “C/C++”, “C++ Intellisense”, “CMake”, “CMake Tools” and “Native Debug”. With them enabled I’m able to write, build and debug simple C++ project.

VS Code is powered by scripts written in JSON. You are using them to write your very own building pipeline.

At the beginning it is not an easy to use application, but after about only one hour I started to understand the concept behind it and now I use it for every small project or test I do. I use it specifically for the C++ development but there are plugins that can transform this tool to the C#, Python, Go or any other language IDE. It supports Version Control System, runs really smooth, is free and open source.

One really cool thing for me is that it looks and feels like a little version of Visual Studio! It has the same keybinding and similar options like peeking definitions.

Zrzut ekranu z 2018-08-21 22-00-42

Conclusion

There are many C++ IDEs for Linux and I’ve described only these that, in my opinion, are the best ones. Other ones are even overcomplicated or heavy on resources or don’t work at all.

Generally – if you are afraid of CMake the Code::Blocks will be the best option. If you are working on big project and have some spare money to invest – CLion is the best and the most complete cross-system IDE for C++. If you are not afraid of constructing your own IDE and scripting the building pipeline (which is not so difficult as it sounds), give the VS Code a try.

Currently I use CLion for bigger, Unreal Engine 4 related projects and the VS Code for smaller projects and quick testing.

I hope this article will help anyone who is struggling with finding the most suitable C++ IDE on Linux, especially when switching from Windows.