This lesson will show you how to install Code Blocks IDE for Windows, Mac and Linux Operating Systems and configure various path and directory settings to start Programming in C.
What do we need to run Programs?
To create and run programs in any programming language, you need two things:
- A text Editor
- A Compiler or an Interpreter
A text editor is where you write your Programs. It can be as simple as using Windows Notepad or Vim in Linux. Other editors designed for programming purposes come with more features such as keyword identification, colour coding, automatic brackets, automatic indentation and more. In short, a text editor is where you write the program.
A compiler or an interpreter is a piece of software, that converts or translates your high/medium level language program into machine-readable language; essentially a stream of 1’s and 0’s. They create a machine-executable binary file (with .exe extension in Windows), and this is executed by the computer.
What is an IDE?
An IDE or Integrated Development Environment is a piece of software that provides various facilities to computer programmers for software development. Ideally, an IDE consists of at least a source code editor, build automation tools and a debugger. Some might also include the necessary compiler or interpreter. Modern IDEs come with advanced features such as Syntax Highlighting, Code Completion, Version Control, Debugging and much more.
Why should we use an IDE?
In this case, after we install Code Blocks IDE, it will allow us to create, compile and execute programs from a single environment. Code Blocks comes with the GCC compiler and can compile for both C and C++. It also has an inbuilt text editor to write programs in. This editor contains Syntax Highlighting, debugging and more such features which will enhance our coding experience.
If we didn’t use an IDE; we would have to first write our programs on a text editor such as Notepad. We would then need to open Command Prompt or terminal (depending upon the OS we are using) and run it from there by typing some commands. The Code Blocks IDE makes this whole process seamless and easy. We just need to write the program in it and press a button to run it.
How to Install Code Blocks in Windows?
- We need to visit the Code Blocks website and go to the download section: Click Here–>
- Once there, we need to scroll down to the ‘Windows’ section and download the latest Code Blocks ‘MinGW-setup.exe’ file from either ‘Sourceforge’ or ‘FossHub’.
We must download the ‘MinGW-setup‘ file as this will also install the GCC compiler into our system. For this case, I will use the Sourceforge link.
- Once we click on the link, it will take us to the download page and the download should begin automatically.
- We would now need to run the ‘.exe’ file, that we just downloaded. On double-clicking on it, we will be presented with the following window:
We must now click on ‘Next’ to continue with the Installation Process.
- We need to ‘Accept’ the License Agreement.
- In the next window, Code Blocks will ask us to select components that we want to Install. Here we will do a full installation. We will select all the options and then click on ‘Next’. We need to make sure that the MinGW Compiler Suite is selected, as this will install the GCC Compiler on our system.
- We need to know, select the destination folder for our installation and then click on ‘Next’.
- The Installation will begin now and may take some time depending upon our system specs.
- Once the installation is complete; Code Blocks will ask us if we want to run it. We will skip this for now by selecting ‘No’.
- We are done with the Setup, we need to click on ‘Next’ and then ‘Finish’ for it to be over.
How to Install Code Blocks in Mac?
The process to Install Code Blocks in Mac Operating System can be quite tricky when compared to Windows. I am being honest when I say, I do not have much experience with Apple devices. With that said, we need to scroll down to the ‘MAC OS X’ section of the Code Blocks download page and download the latest Code Blocks ‘.zip’ file from either ‘Sourceforge’ or ‘FossHub’. After extracting this file we should be able to run Code Blocks on MAC. I have included a video below in case someone faces issues in the Installation process.
How to Install Code Blocks in Linux?
There are various Linux distributions which support Code Blocks such as Ubuntu, Fedora, CentOS, RedHat etc. Here we will learn how to install Code Blocks for Ubuntu which is one of the most widely used Public Linux distribution.
We need to first open Terminal in Ubuntu and type this command:
$: sudo add-apt-repository ppa:damien-moore/codeblocks-stable
The system will then prompt us to Press Enter. We now need to enter the second command:
$: sudo apt-get update
The above command will update all the packages on our system. We now need to enter this final command:
$: sudo apt-get install codeblocks codeblocks-contrib
This will download and install on our Ubuntu System.
Thus we have learnt to install Code Blocks on various Operating Systems. In the next lesson, we will write and run our first C Program.
Sharing is Caring
If you liked this lesson, then feel free to share it with your loved ones!