How to Install Code Blocks IDE on Ubuntu Linux

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.

Note

Code Blocks is also available in Ubuntu Software Center. However, as of Ubuntu 21.04, installing Code Blocks graphically from the Ubuntu Software Center installs a codeblocks-common package, not the graphical IDE. And thus you don’t see the Code Blocks installed on your system to run. For this reason, I recommend taking the terminal approach for installing Code Blocks on Ubuntu.

Install Code Blocks on Ubuntu-based Linux distributions

The Code Blocks IDE is available in the universe repository of all Ubuntu releases. Though it is usually enabled by default, it won’t harm to enable universe repository first:

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
install code blocks ubuntu

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:

code blocks ubuntu

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.

code blocks ide first run

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.

code blocks ide

When you run the code, it opens a new terminal window to display the output.

code blocks code run terminal

That’s the bare minimum information you need about Code Blocks. I leave it up to you to explore it further by going through its wiki and user manual.

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.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.