In search of the best C++ IDE on Linux

There was a time I decided to try a Linux. One of the issues I had was that I struggled to find a good C++ IDE.

Here is a joke:
"The best IDE to write C++ in Linux is the Linux itself."
It is a well known fact 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 very 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 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 cross platform distribution and continous delivery.

Code::Blocks

This IDE has a really strong Visual Studio vibes. Creating a new project takes only few clicks, there are no extra steps needed to setup a compiler and a 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, there are few things that can be annoying. 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

CLion is an 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 you 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 project is a pleasure with quick definition peeking, switching between definition and declaration and fast opening 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.

Unfortunately – the quality comes with the price as it is not a free software. But still – if you are thinking about serious C++ development in Linux (and not only) this is the best IDE you can get.

Visual Studio Code

VS Code is a strange entity. Actually, it is not strictly a C++ IDE. It is a highly scriptable text editor such as Sublime or Atom, which can be extended by plugins. I was rather sceptical to it but the longer I was working with it the more I was falling in love with it.

With some work it can be transformed into a lightweight IDE for C++ with building system based on CMake, code suggestions 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 was able to write, build and debug simple C++ project.

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 I do. I use it specifically for C++ development but there are plugins that can transform this tool into the C#, Python, Go or any other language IDE. It supports version control system, runs really smooth, is free and open source.

Another really cool thing for me is that the navigation and default key bindings are very similar to the Visual Studio ones.

Conclusion

There are many C++ IDEs for Linux and I’ve described only these that, in my opinion, are the best. Other ones were even overcomplicated or heavy on resources or didn’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 a VS Code a try.

Currently I use CLion for bigger projects and 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.