How to Install Code::Blocks on Ubuntu 20.04
Written in C, Code::Blocks ( Yes, with a double full colon) is a free and opensource, cross-platform IDE for C, C++, and FORTRAN projects. It provides a very simple UI that makes it simple to navigate and create projects. It’s quite easy to use and is made quite extensible using plugins.
The Code: Blocks IDE supports a wide range of compilers. These include the GNU GGC Compiler, LLVM Clang compiler, OpenWatcom, Digital Mars, and so many others.
There are mainly two ways to install Code::Blocks IDE on Ubuntu 20.04 and we cover both.
Method 1: Install Code::Blocks IDE using APT
Code::Blocks IDE is available on Ubuntu repositories and can be installed with the APT command. Installation from the default repository is the simplest method, But it may have bit older versions.
First update your system:
To install codeblock on Ubuntu , run the following command:
When prompted to continue, just type ‘Y’ and press ENTER to proceed.
Method 2: Install Code::Blocks IDE using a Deb file
Alternatively, you can use a Deb file to install the IDE. First, download it as shown.
Once downloaded, run the Code:Blocks Debian file as shown.
The latest code block binary is also available to download as compressed archives. Download tar.xz file and extract to get code blocks deb file.
Launching Code::Blocks IDE
To launch Code::Blocks IDE, search for it using the application manager as follows. Once the Code::Blocks IDE icon appears, click on it.
The autodetection of the compiler will take place, as the IDE requires a compiler to compile the source code. In this case, I already have the GCC compiler in place. Once the compiler has been successfully detected, click ‘OK’.
And finally, the Code::Blocks IDE interface will come into view as you can see below.
Codeblock 20.03 is the available version at the time of writing this tutorial.
Remove Code::Blocks IDE
To remove codeblocks from ubuntu, run the following command:
To complete remove codeblock and its associated configurations, run the following two commands:
Conclusion
Though not as popular as other IDEs such as IntelliJ IDEA or Visual Code Studio, Code:Blocks IDE is a fairly decent IDE for your C and C++ projects. It’s lightweight and fast and is ideal for beginners who are starting out in software development. We hope that you can comfortably install CodeBlocks IDEA on Ubuntu 20.04.
Источник
CPP Fuzz
Friday, July 4, 2014
[ALLEGRO] Setup w/ Code::Blocks (Or any other setup)
Introduction
Hey guys, I decided to redo my old Allegro tutorial, seeing as it was pretty outdated. So, let’s get started setting up Allegro on Windows with Code::Blocks.
Prerequisites
- Allegro:
How do you expect to get anything done without this? It’s the what the tutorial is for! You can download it here: http://alleg.sourceforge.net/download.html
Windows users will have to scroll all the way down to the bottom to get the link. Window hate? Not quite, Unix/Linux/Mac users all have to compile it!
(Though, it might be easier to compile it )
We’ll assume you’re compiling Allegro. Let’s continue.
We’re using this to set up Allegro with, but if you’re macho enough, you can do it with any other setup. Download Code::Blocks here: http://www.codeblocks.org/downloads
This is needed to run the «hello world» program.
If you are going to compile the source files
Allegro is divided into a core library and a number of addon libraries.
The core library depends on certain libraries to function. If you don’t have
those, nothing will work. These are required for the core library:
— DirectX SDK (Windows only)
You can get this for MSVC from the Microsoft web site (large download).
Alternatively, smaller downloads for MSVC and MinGW are available here:
Some of those are originally from:
— X11 development libraries (Linux/Unix only)
The libraries will be part of your Linux distribution, but you may have to
install them explicitly.
— OpenGL development libraries (optional only on Windows)
The addons, too, may require additional libraries. Since the addons are
strictly optional, they are not required to build Allegro, but a lot of
functionality may be disabled if they are not present.
Windows users may find some precompiled binaries for the additional libraries
from . You need to get the `bin` and `lib`
packages. The `bin` packages contain DLLs, and the `lib` packages contain the
headers and import libraries.
Mac users may find some dependencies in Fink or MacPorts.
and
Linux users likely have all the dependencies already, except PhysicsFS
and DUMB. If your distribution uses separate development packages, they
will need to be installed. The packages are probably named *-dev or *-devel.
These are the dependencies required for the addons:
— libpng and zlib, for PNG image support (Unix and older MinGW only)
Home page:
Windows binaries:
On Windows/Mac OS X/iPhone, PNG image support is available by using the
native facilities on the respective operating systems, so libpng is not
required.
— libjpeg, for JPEG image support (Unix and older MinGW only)
Home page:
Windows binaries:
On Windows/Mac OS X/iPhone, JPEG image support is available by using the
native facilities on the respective operating systems, so libjpeg is not
required.
— FreeType, for TrueType font support.
Home page:
Windows binaries:
— Ogg Vorbis, a free lossy audio format. (libogg, libvorbis, libvorbisfile)
Home page:
— FLAC, a free lossless audio codec. (libFLAC, libogg)
Home page:
— DUMB, an IT, XM, S3M and MOD player library. (libdumb)
Home page:
— OpenAL, a 3D audio API.
The audio addon can use OpenAL, although the 3D capabilities aren’t used.
On Mac OS X, OpenAL is *required* but should come with the OS anyway.
On Linux and Windows, OpenAL will only be used if you request it, hence there
is no reason to install it specifically.
— PhysicsFS, provides access to archives, e.g. .zip files.
Home page:
On Windows it may be a pain to place all these libraries such that they can be
found. Please see the README_cmake.txt section on the «deps subdirectory»
when the time comes.
Got that? Let’s continue. Windows users can either choose to build it or grab the binaries, get the binaries here to save time: https://www.allegro.cc/forums/
Getting Allegro out the box
If you are using the binaries
If you are building Allegro
Allegro is stuck inside an archive, we need to get it out pronto if we want any work done. So get it out here and we can start. After you’ve finished extracting that son-of-a-gun, move into the «allegro» directory inside it. It should be like: allegro- -> allegro
In there, you will see many cryptic files and folders. Don’t scream at them! Calm down, and I’ll tell you the next step.
You will have to compile Allegro as it is all source code, for convenience, we’ll use CMake to help build it all. You can get CMake from here: http://www.cmake.org/
Once you’ve installed CMake, you should run it so we can begin the compilation. It would be best to read the Readme:
Welcome to Allegro 5, a cross-platform game programming library.
Currently supported platforms are Linux/Unix, Windows, MacOS X and iPhone.
Note that Allegro 5 is wholly *incompatible* with Allegro 4 and earlier
versions, but both may be installed at the same time without conflicts.
This readme contains general information which applies to all platforms
that Allegro builds on.
README_cmake.txt discusses some build options for cmake.
README_msvc.txt discusses compilation on Windows with Microsoft Visual C/C++.
README_make.txt discusses compilation with GNU make. This applies to Unix-like
operating systems such as Linux, MacOS X and MinGW on Windows.
README_macosx.txt has a few additional notes for MacOS X.
README_iphone.txt discusses iPhone operating systems.
We assume you have C and C++ compilers installed and functioning.
We support gcc and MSVC.
Allegro also requires CMake 2.6 or later to build.
You may download it from
Allegro is divided into a core library and a number of addon libraries.
The core library depends on certain libraries to function. If you don’t have
those, nothing will work. These are required for the core library:
— DirectX SDK (Windows only)
You can get this for MSVC from the Microsoft web site (large download).
Alternatively, smaller downloads for MSVC and MinGW are available here:
Some of those are originally from:
— X11 development libraries (Linux/Unix only)
The libraries will be part of your Linux distribution, but you may have to
install them explicitly.
— OpenGL development libraries (optional only on Windows)
The addons, too, may require additional libraries. Since the addons are
strictly optional, they are not required to build Allegro, but a lot of
functionality may be disabled if they are not present.
Windows users may find some precompiled binaries for the additional libraries
from . You need to get the `bin` and `lib`
packages. The `bin` packages contain DLLs, and the `lib` packages contain the
headers and import libraries.
Mac users may find some dependencies in Fink or MacPorts.
and
Linux users likely have all the dependencies already, except PhysicsFS
and DUMB. If your distribution uses separate development packages, they
will need to be installed. The packages are probably named *-dev or *-devel.
These are the dependencies required for the addons:
— libpng and zlib, for PNG image support (Unix and older MinGW only)
Home page:
Windows binaries:
On Windows/Mac OS X/iPhone, PNG image support is available by using the
native facilities on the respective operating systems, so libpng is not
required.
— libjpeg, for JPEG image support (Unix and older MinGW only)
Home page:
Windows binaries:
On Windows/Mac OS X/iPhone, JPEG image support is available by using the
native facilities on the respective operating systems, so libjpeg is not
required.
— FreeType, for TrueType font support.
Home page:
Windows binaries:
— Ogg Vorbis, a free lossy audio format. (libogg, libvorbis, libvorbisfile)
Home page:
— FLAC, a free lossless audio codec. (libFLAC, libogg)
Home page:
— DUMB, an IT, XM, S3M and MOD player library. (libdumb)
Home page:
— OpenAL, a 3D audio API.
The audio addon can use OpenAL, although the 3D capabilities aren’t used.
On Mac OS X, OpenAL is *required* but should come with the OS anyway.
On Linux and Windows, OpenAL will only be used if you request it, hence there
is no reason to install it specifically.
— PhysicsFS, provides access to archives, e.g. .zip files.
Home page:
On Windows it may be a pain to place all these libraries such that they can be
found. Please see the README_cmake.txt section on the «deps subdirectory»
when the time comes.
To build the documentation you will need Pandoc.
Pandoc’s home page is
Installing Pandoc from source can be challenging, but you can build Allegro
without building the documentation.
Online documentation is available on the Allegro web site:
Building with CMake is a two step process. During the _configuration_ step,
cmake will detect your compiler setup and find the libraries which are
installed on your system. At the same time, you may select options to
customise your build. If you are unsure of what you are doing, leave all the
options at the defaults.
Once the configuration step is successful, you will invoke another tool to
build Allegro. The tool depends on your compiler, but is usually either
`make`, or your IDE.
To avoid problems, unpack Allegro into a directory *without spaces or other
«weird» characters in the path*. This is a known problem.
Now read README_msvc.txt, README_make.txt or README_macosx.txt.
Including the additional readmes that came with your copy. Just read it all and let it all soak in so we can continue to our next step.
With CMake open, we have to first find the button that reads, «Browse Source. «. We need this to locate our source code we are building, select the «allegro- /allegro» directory to continue. It is the directory that contains CMakelists.txt, which we need in order to build with CMake, do not use the «allegro- /allegro/src» directory. It will not work.
Next, we need to tell CMake where to build everything. I would just make a folder called «build» in the «allegro- /allegro» directory. Build it there.
Next, choose configure. Here, you will have to choose your set up. Mine is «CodeBocks — MinGW Makefiles» and I specified the native custom MinGW compiler I have in another directory. Be sure to choose the correct set up!
Now just wait for it to configure. Done!
It’s not unlikely that CMake failed the first time, read the error and try to make sense of it. For example, mine say it failed because:
Allegro readme wrote: You can get this for MSVC from the Microsoft web site (large download).
Alternatively, smaller downloads for MSVC and MinGW are available here:
Some of those are originally from:
So I tried to download the SDK from those links. both were down. I can’t download the Direct X SDK from microsoft, it’s HUGE. So instead, I googled and found this: http://alleg.sourceforge.net/wip.html
At the bottom of the page it reads:
243 kibibytes is awesome.
Download that, extract it, and then copy and paste the «include» and «lib» directories to overwrite their counterparts in the compilers directory. Just to be safe, don’t overwrite any files.
Now, be sure to start over by deleting your Cache (File -> Delete Cache), you’ll be able to click configure again to try once more.
Seems I still have errors:
That means, we did not get the dependencies the Readme told us to get. So get them now and we can continue. Now that this is done, we can hit the «Generate» button to generate a Code::Blocks project. Open it up and Code::Blocks, select which build target to build, and hit build. Now wait as it compiles. After it is done, install it. You can copy and paste files or use some other method. Proceed to the next portion of the tutorial.
Setting up Allegro for use
Now, let’s start up Code::Blocks and hit the «File» item in the top left of the window. Then, go to New -> Project. A new menu will jump up at ya. Select «Console Application» from that list then, hit «Go». You’ll be presented with a Wizard that I’ll guide you all through, cause I’m so brave.
Project title: Allegro 5
Folder to create project in: C:\
3. Enter the information as stated above. (The rest is filled in automatically)
Hit «Next>».
Now, we should be back at where we were. Copy and Paste (Don’t make copying and pasting code a habit! ) this code here:
Remember to save!
Compile the program and run it to test it out.
Источник