Code Blocks is an open source IDE written in C++ and ideal for C, C++ and Fortran development. It is cross-platform and runs on Linux, macOS and Windows.
Code Blocks is lightweight and fast. It supports workspaces, multi-target projects, inter project dependencies inside workspace.
You get syntax highlighting, code folding, tabbed interface, class browser, smart indentation and more. You can also extend the feature of the IDE via plugins.
In this tutorial, you’ll learn to install Code Blocks on Ubuntu-based Linux distributions.
Install Code Blocks on Ubuntu-based Linux distributions
sudo add-apt-repository universe
Update the package cache so that system knows about the availability of the additional packages from the newly added repository:
sudo apt update
And finally, you can install Code Blocks on Ubuntu-based distributions using the apt install command:
sudo apt install codeblocks
It is advised to also install additional plugins to get more out of the Code Blocks IDE. You can install them using the codeblocks-contrib package:
sudo apt install codeblocks-contrib
How to use Code Blocks
Search for Code Blocks in the system menu. This is what it looks like in Ubuntu’s default GNOME version:
When you first start Code Blocks, it looks for all the available compilers on your system and adds it to the path so you don’t have to configure it on your own.
In my case, I already had gcc installed on my Ubuntu system and it was well recognized by Code Blocks.
The user interface of Code Blocks is definitely not modern but keep in mind that the IDE is lightweight and it hardly consumes 50 MB of RAM.
If you have ever used another IDE like Eclipse, you won’t find it difficult to use Code Block. You can write your code and organize them in projects.
The buttons to build, run and build and run together is right their on the top.
When you run the code, it opens a new terminal window to display the output.
Having an IDE makes running C or C++ programs on Linux easier. Eclipse is a good IDE for that job but it consumes more system resources than Code Blocks. Of course, in the end, it’s your choice that matters.