Меню Рубрики

Установка code blocks ubuntu

How to Install Code Blocks on Ubuntu 16.04, Ubuntu 18.04, 19.04

This tutorial will be showing you how to install Code Blocks on Ubuntu 16.04/Ubuntu 18.04, 19.04. Code 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 17.12, was released on December, 2017.

  • 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/Ubuntu 18.04, 19.04

Code Blocks is in the default Ubuntu package repository, so you can open up a terminal window and run the following command to install it.

However, Ubuntu repository only contains the outdated version (Code Blocks 16.01). To install the latest version, download the latest version.

Now in the current directory, there are many Code Blocks deb packages. We need to run the following command to install Code Blocks.

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

Choosing a C Compiler

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

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 the Clang compiler:

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

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

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

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


Установка и настройка Code::blocks на Banana Pi, Orange PI и Raspberry Pi под Ubuntu

Установка Code::Blocks >

В дальнейшем, для работы с WiringPi на языке C/C++, нам нужен будет IDE. Так как я не люблю писать в блокнот и потом компилировать всё это в терминале, мы установим Code::Blocks IDE.
И так, для начала необходимо установить компилятор gcc и g++. Как правило, оба компилятора уже установлены разработчиками ОС Ubuntu. А если их на вашей ОС нема, тогда установите оба компилятора так:

С этими компиляторами можно компилировать программы в консоли, также ими пользуются среды программирования такие как Code::blocks.
Code::blocks тоже можно установить через терминал:

Создание нового проекта WiringPi в Code::blocks и его настройка

Похожие записи

Комментарии 9

cannot find -l -lwiringPi
cannot find -l -lpthread
как решить эти ошибки ?

Добавлять нужно не в поле libraryes а в поле linker options

cannot find -l -lwiringPi — нужно установить wiringPi
cannot find -l -lpthread — нужно установить gcc, это часть его

Как подружить Code::Blocks IDE с русскими буквами ? Земетил переодическое завершение программы из-за наличия русских символов в коде(вывод на lcd) или коментариях .

Я думаю, что это баг Code::Blocks, у меня такая-же проблема, по этому я перешёл на CodeLite, не такой удобный, но не вылетает внезапно

Это работает:
sudo gcc main.cpp -o blink -lwiringPi -lpthread

А кодблокс не работает:
ld cannot find -l -lwiringPi
ld cannot find -l -lpthread

Goto Settings->Compiler and Debbuger, Choose Linker settings tab.
In Link libraries click add and choose «/usr/lib/libwiringPi.so

Чё-т Code::blocks не хочет ставиться

Какие ошибки/сообщения выдаёт при установке, какая операционная система у вас стоит, на какой плате.

Добавить комментарий Отменить ответ

We are using cookies to give you the best experience on our website.

You can find out more about which cookies we are using or switch them off in settings .

Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

Strictly Necessary Cookies

Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.

If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.


How to install the Code::Blocks > Ask Question

I am using 64-bit Ubuntu and I want to install the Code::Blocks IDE. Is there any repository?

Читайте также:  Установка замка в калитку гаражных ворот

8 Answers 8

Code::Blocks is a cross-platform Integrated Development Environment (IDE). It is based on a self-developed plugin framework allowing unlimited extensibility. Most of its functionality is already provided by plugins. Plugins included in the base package are:

  • Compiler frontend to many free compilers
  • Debugger frontend for GDB (and CDB for windows platforms)
  • Source formatter (based on AStyle)
  • Wizard to create new C++ classes
  • Code-completion / symbols-browser (work in progress)
  • Default MIME handler
  • Wizard to create new Code::Blocks plugins
  • To-do list
  • Extensible wizard based on scripts
  • Autosave (saves your work in the unfortunate case of a crash) 1

To download and install click the image below.

1 Source:Ubuntu Apps Directory

It’s available in the Software Center.

Just open the Ubuntu Software Center and search for its name.

Or install via the terminal:

From the Code::Blocks website, the download page for Linux points to the Code::Blocks Release Builds PPA, which is probably the easiest way to install a reasonably up-to-date version of Code::Blocks. To install Code::Blocks from the aforementioned PPA, do the following:

You can install CodeBlocks using following command:

If you plan to develop on ubuntu its beneficial to learn how to compile code from the command line . even the codeblocks IDE

pick file similar to codeblocks_16.01.tar.gz

cd into where you wish to expand the tarball and issue

now its installed . go ahead and launch

If above gives errors you probably have yet to install upstream dependancies . if so this may help

All you need to do is to run:

Your repository list isn’t up to date, you got update suggestion from Ubuntu. If you want to be Linux programmer I’m recommending you getting LPIC-1 knowledge before you start. It is crucial to understand basics of this system to code for it.

I suggest to use newest version from ‘Jens’ Even if it’s unofficial, we can get all versions. You can also choose repositury or just’deb’ file.

For stable release, add these two lines to the sources.list file and refresh the package index

Then install the codeblocks. Tested on Ubuntu 12.04 — both 32 and 64 bit.

You can try installing the packages manually. Connecting via FTP to the archives with your file manager. Or download manually from the site in the link below.

Alternatively install it via GUI with GDEBI by clicking each deb file which will indicate if another package/dependency is missing then install that one first. You can start with Codeblocks and GDEBI will indicate the directly related packages and you follow that and avoid getting lost in dependencies.

Don’t know if a file association can be made to click and trigger GDEBI directly from the browser.

The server is : ftp.archive.ubuntu.com

And the path to Codeblocks is : ubuntu/ubuntu/pool/universe/c/codeblocks

The files will be saved to HOME

delete the DEBs of the undesired architecture

You can check for answers on how to use the script, Make it executable and run it from the HOME.

Replace echo with the bash command to install packages :

Change the list message with the list of packages for Codeblocks in the HOME folder

Match the number of packages to the list of 12 elements

If 20 elements then 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20


How to Install C++ Code::Blocks in Ubuntu Linux

C++ For Dummies, 7th Edition

Code::Blocks for C++ does not include gcc on Linux, so installation is a two-step process. First you will need to install gcc. Then you can install Code::Blocks.

Installing gcc

The gcc compiler is readily available for Linux. Follow these steps to install it:

Enter the following commands from a command prompt:

The standard Ubuntu Linux distribution includes a GNU C compiler, but it does not include the C++ extensions and, in particular, not the C++ 2011 standard extensions. The first two commands update and upgrade the tools you already have. The third command installs C++.

Enter the following command from a command prompt:

You’ll be fine with version 4.7.1 or later. If you have an earlier version, some of the C++ 2011 features may not work properly, but otherwise, it should be okay.

If you are using Debian Linux, the commands are the same. If you’re using Red Hat Linux, replace the command apt-get with yum so that you end up with

Installing Code::Blocks

Fortunately for all concerned, an Ubuntu-ready version of Code::Blocks is available in the Ubuntu Software Center. Many other versions of Linux include something similar to the Software Center. Follow these steps to install Code::Blocks:

Click on the Software Center icon on the Ubuntu desktop.

Select Code::Blocks from the list of available software.

This will start the installation process.

Code::Blocks searches your hard drive for your C++ compiler. It should be able to find it without a problem, but if it doesn’t, then execute the following steps.

Читайте также:  Установка базовых станций документы

Select the Compiler Flags tab.

Make sure that the following three flags are selected, as shown in this figure:

Enable All Compiler Warnings

Have g++ Follow the Coming C++0x ISO C++ Language Standard

Have g++ Follow the C++11 ISO C++ Language Standard

Select the Toolchain Executables tab.

Navigate to /usr , unless you installed your gcc compiler someplace other than the default location of /user/bin .

The “C compiler” should be gcc, the “C++ compiler” should be g++ and the “Linker for dynamic libs” should be g++.

Select OK to close the dialog box.

About the Book Author

Stephen R. Davis is the bestselling author of numerous books and articles, including C# For Dummies. He has been programming for over 30 years and currently works for Booz Allen Hamilton in the area of Homeland Defense.


Installing Code::Blocks from source on Linux

These are instructions on how to build Code::Blocks under Linux. These instructions should work for all Linux distros, as we’ll be installing from sources.



In order to successfully compile Code::Blocks, the wxWidgets User Interface library must be installed. For most Linux users, this is maybe the only dependency not already installed. wxWidget can be used directly on top of the X server, in this case the variant of the wxWidget library is called wxX11. However this library is sub-par compared to other toolkits and unstable. Hence Code::Blocks uses wxGTK, the version of wxWidget based on GTK+. The exact requirement is libwxGTK-2.8.0 or later (2.8.3 is not recommended because of some troubles). This creates an additional dependency on GTK+, consider the following:

A possible implementation which does not exist:

Code::Blocks -> xwWidget (libwxX11) -> X

Current Code::Blocks implementation:

Code::Blocks -> xwWidget (> libwxGTK2.8) -> GTK+ (> libgtk-x11-2.0) -> X

This document helps you to install libwxGTK if necessary but does not cover the installation of GTK+. GTK+ is probably installed on your Linux anyway, so don’t worry 😉

Note: All the instructions below, assume an existing directory named

/devel. If you ‘ll be using a different one, adjust the path to match. As a first step create this directory:

Checking the presence of GTK+ library

Have a look in /usr/lib ( /usr/lib/x86_64-linux-gnu for 64 bits) for something like «libgtk-x11-2.0.so» (Note the library must be 2.0 minimum). Alternatively, do a search with your package manager or go to your Linux distribution forum for help. If you don’t want to loose time, you can even forget this check since there is a good probability that everything is already installed.

Library wxGTK installation

Checking the presence of libwxGTK library

In your package manager, look for ‘libwxgtk’ keyword and verify that all libwxgtk2.8 stuffs are installed. If you find the libraries uninstalled, just install them and go directly to Code::Blocks installation.

Alternatively you can do the same in the command line (the following is an example, there may be more than two packages):

If you don’t find any packages you must install the library from source as described below, and you can redo this check afterwards to verify that the installation worked correctly.

Note for Debian and Ubuntu users: You can use

to see which version of libwx is there or not and currently active.

And, Debian and Ubuntu user can use this to add a value to the list of choices

Getting wxGTK sources

Visit the wxWidgets web site. Click the «Download» button at the top of the page. Under wxWidgets 2.8.7 downloads, select wxGTK. Save the file in

/devel. After the download finishes, switch to

Now, untar the wxGTK sources:

Switch to the wxGTK directory:

Building wxWidgets

Here we will create a separate build directory instead of building from the src directory, so that we can easily rebuild with different options (unicode / ansi, monolithic / many libs, etc).

The documentation says the default is for gtk2 to use unicode and wx > 2.5 to build as a monolithic library. This doesn’t appear to be the case, so these flags are passed to configure:

Add /opt/wx/2.8/bin to the PATH (if your shell is bash then edit /etc/profile or

/.bash_profile) (On Suse 10.1 edit /etc/profile.local, it will only be available after a new login). An example PATH:

Add /opt/wx/2.8/lib to /etc/ld.so.conf (nano /etc/ld.so.conf), then run:

That’s it. Now the linker will look in /opt/wx/2.8/lib for wx libraries and you will have a monolithic shared library unicode build.

To check that things are working, type:

which should give you /opt/wx/2.8

which should have at least:

but can contain other flags as well.

should return /opt/wx/2.8/bin/wx-config

Code::Blocks installation

Getting Code::Blocks sources

You can get Code::Blocks source code from the website as a tarball or from the SVN repository (this second method is described below).

Читайте также:  Установка перемычек из металла
From SVN repository

NOTICE: The SourceForge CVS is no longer used although it still exists.

Enter your development directory:

Then checkout the source using one of these methods. This will create the directory trunk. Change to the source code directory, by issuing the following command:

If you are a Gentoo user at this point, please see Compiling_Code::Blocks_in_Gentoo.

Before beginning, it is often a good idea to check you have recent versions of autoconf and automake — repositories versions are not always recent enough. (if you do not have automake, then you will get «cannot find aclocal» error). If you’re compiling the svn trunk versions of CodeBlocks (or future versions) then the unix build has switched to autotools. So first build wxWidgets as described above and then build CodeBlocks. In short, these commands build Code::Blocks from sources and installs it:

The long story is as follows: First run:

This sets up the configure script and its dependencies. It only needs to be run once (after downloading the source from svn).

. then install the «libtool» package using your package manager.

. then the «autoconf» and «automake» package using your package manager.

. then there exists a problem with DOS line-endings, for example if you cross compile to a Windows partition. Simply check-out a fresh copy of CodeBlocks from SVN.
Or, instead of downloading from SVN, you might consider using the little command line tool dos2unix, which normally comes with most distributions.

. (configure aborts with some unspecific error messagelike that), then you might consider also running dos2unix bootstrap acinclude.m4 codeblocks.pc.in configure.in Makefile.am before running bootstrap. Once you’ve run the bootstrap script, jump to next step.

. then aclocal is having trouble finding the wxWidgets .m4 files. You can do one of two things: To just get bootstrap to find the path this time do:

To change the aclocal search path more permanently do:

Then aclocal will also search somewhere like /opt/wx/2.8/share/aclocal

Note for Ubuntu users: The above is not the correct way to fix the AM_* errors. Rather, you only need to install the package named «wx-common» (Universe repository).

. then this can be solved by something like:

(. maybe adopting the path, so use `wx-config —prefix` is necessary.)

Installing Code::Blocks sources

You can read the BUILD file included in the source, but everything is very straightforward. Do:

You may need to run make install with super user rights, in that case use:

If you have multiple versions of wxWidgets installed or kept them in place, you can use:

Note: The Nassi Shneiderman plugin (part of the contrib plugins) has a dependency on boost which is needed to compile this plugin. Boost does not need to be compiled therefore. It is not checked for the existing of boost at the moment (except for debian build-system, there it is a build-dependency), so if you configure C::B to be build without Nassi Schneiderman, it should not lead to problems in case you don’t have/want boost.

To uninstall you can later run:

If you want to recompile everything, first run:

and then follow the above sequence for installing.

By default, CodeBlocks will install to /usr/local. If you want it in its own tree (so you can have multiple versions of CodeBlocks, each in its own subdirectory of /opt) replace the above ./configure command with:

or similar. Then you can later install a different build like:

followed by ‘make && make install’ as usual.

By default, CodeBlocks will not compile the contributed plugins from SVN. If you want to compile / install them too, replace the above ./configure command with:

followed by ‘make && make install’ as usual.

To see a list of other options available for configuring the build of CodeBlocks do:

To compile under Gentoo, use:

Resolving runtime issues

When running Code::Blocks after the installation it might happen, that the system complains:

In that case make sure the library path where the Code::Blocks libraries where installed into is «known» to the system. For example: On Ubuntu using a default build process on a clean system will install the Code::Blocks executables to /use/local/bin and the libraries to /usr/local/lib. The latter is usually not known to a «clean» Ubuntu system. To add it to the search path for libraries do the following (as root / using sudo respectively): Add the following line to the file /etc/ld.so.conf:

That’s it — Code::Blocks should now work just fine as all libraries are being found.

Note that for both you may need super user rights again — so use the sudo command as needed.


Добавить комментарий