How to Install Code Blocks on Ubuntu 16.04/17.04

This tutorial will be showing you how to install Code Blocks on Ubuntu 16.04/17.04Code Blocks is a free, open-source integrated development environment (IDE) for C, C++ and Fortran. It can run on Linux, Mac, Windows. The latest version, Code Blocks 16.01, was released on January, 2016.

Code Blocks features:

  • Supports multiple compilers including GCC, Clang, Visual C++, MinGW and many more
  • Custom build system and optional Make support.
  • Syntax highlighting and code folding
  • C++ code completion, class browser, a hex editor
  • A debugger with full breakpoint support
  • A plug-in system to support other programming languages.
  • And more

How to Install Code Blocks IDE on Ubuntu 16.04/17.04

Code Blocks is in the default Ubuntu package repository.

sudo apt install codeblocks

Ubuntu 17.04 contains Code Blocks version 16.01. However, the version is outdated in Ubuntu 16.04. To install the latest version, you can use PPA. Run the following 3 commands to add Code Blocks PPA to system, update local package index and install the package.

sudo add-apt-repository ppa:damien-moore/codeblocks-stable

sudo apt update

sudo apt install codeblocks codeblocks-contrib

code blocks ubuntu

Once installed, you can start Code Blocks IDE from Unity Dash or your preferred app launcher.

install code blocks ubuntu 16.04

Choosing a C Compiler

Upon first launch of Code Blocks, you will be prompted with a Compilers auto-detection window:

c compiler

Tow popular open-source C compilers available for Linux are:

  • GNU C Compiler – the defacto-standard open-source C compiler
  • Clang – Clang is much faster and uses far less memory than GCC and it provides extremely clear and concise diagnostics (error and warning messages).

To install gcc, run:

sudo apt install gcc

To install the Clang compiler:

sudo apt install clang

If you want to compile native Windows binaries on Linux, then you can install the mingw-w64 package.

sudo apt install mingw-w64

After choosing your default C compiler, you can start using Code Blocks to write programs.

ubuntu code blocks setup

You can also choose your default compiler by going to Settings > Compiler > Global Compiler Settings.

codeblocks ubuntu

That’s it! I hope this tutorial helped you install Code Blocks on Ubuntu 16.04/17.04.

Rate this tutorial
[Total: 77 Average: 4.1]

12 Responses to “How to Install Code Blocks on Ubuntu 16.04/17.04

  • Jerry Black
    10 months ago

    After you add the PPA to apt-get and do an update. you need to call ‘sudo apt-get install codeblocks-common’ not ‘sudo apt install codeblocks codeblocks-contrib’ .

    • Xiao Guo-An (Admin)
      10 months ago

      If you do ‘sudo apt install codeblocks codeblocks-contrib’, the codeblocks-common package will be automatically selected.

  • Elizandro G. Roos
    10 months ago

    that ppa installs codeblocks 16.01, which is outdated!

  • why is the build and run ‘icons’ are hidden in toolbar? i am having the same problem even when installing from the ubuntu software store.

  • excellent … ma version ubuntu 16.04 avait dans ses ppa uniquement la version 13.12 avec plein de bugs!!
    merci …
    il me manque juste une version plus récente de gcc ! la mienne est la 5.4.0.
    or la 6.2 est déjà sortie !!!!
    comment faire ?

  • hello,
    I’m very new in Ubuntu. I have 16/04 version and I tried to do what you showed here.
    I got error. do you know how to help me? thank you

  • Oh damn, i tried to close the terminal image recursively and laughed out loud when i found my stupidity

  • Iancu Ivasciuc
    2 months ago

    Thanks for tutorial, but I got an error in the final: The following packages have unmet dependencies:
    codeblocks : Depends: codeblocks-common (= 16.01~ubuntu16.04.1) but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.

  • Hey! i just tried to add the PPA but i got this error message

    E: the repository ‘http://ppa.launchpad.net/damien-moore/codeblocks-stable/ubuntu bionic release’ does not have a release file

    What should I do? thank you

  • Nayyer Abbas
    2 weeks ago

    When I tried to execute these command I got the following error:
    udo apt install codeblocks
    >>> /etc/sudoers.d/test: syntax error near line 1 <<<
    sudo: parse error in near line 1
    sudo: no valid sudoers sources found, quitting
    sudo: unable to initialize policy plugin
    Help……

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • If my answer helped you, please consider supporting this site. Thanks :)