02- C Programming Tutorials- Installing Code Blocks IDE Leave a comment

Hello everyone and welcome back to the Blog.

In this post, we are going to download the Code Blocks IDE required for writing, compiling and running C programs.

To create and run programs we need two things:

  • A Text editor
  • A Compiler

A text editor is where we write our programs. A compiler translates our program into a binary stream of 1s and 0s which a computer can understand. So whenever we compile a program, the compiler creates a new binary file called executable (having .exe extension in Windows) which computer can execute.

We can create our programs using any default text editor like Notepad in Windows or vim in Linux, but to make things easy we will install a cross-platform IDE(Integrated Development Environment) called Code Blocks.

Why use an IDE???

IDE allows us to create, compile and run programs from a single environment. Code Blocks comes with a compiler called GCC to compile C and C++ programs. If we are not using an IDE then we need to create the program using our text editor. Then to compile the program we need to open the command prompt or terminal and type some commands. Using an IDE gives us the flexibility of ignoring these steps and directly compile and run the program fro the IDE itself.

Installing Code Blocks in Windows

capture1

  • Wait for some time for the download to start. It might differ depending on the speed of your connection.
  • After downloading double click on the setup to run it and you will be presented with the following window. Click next to continue.

capture3

  • Accept the license agreement.

capture4

  • In the next window, Code Blocks will ask you to select components you want to install. Select Full Installation, it will look something like this:

capture5

  • Select the destination folder (best to keep it default) and click next.

capture6

  • Installation should now begin, wait for it to finish.

capture7

  • Now click on the Finish button to complete the installation.

capture8

This completes the installation of CodeBlocks on windows.

Installing Code Blocks in Linux

Code Blocks can run or various Linux distributions. For example Ubuntu, Fedora, CentOS etc. In this section, we will learn how to install Code Blocks on Ubuntu 16.04.1.

Open terminal and type the following command.

After entering this command, you will be asked to press enter. Hit enter and enter the next command:

This command will update all the packages on the system. Finally, enter the following command:

This command will download and install code blocks on your system.

The first run

On Windows go to Start > All Programs > Code Blocks to launch Code Blocks. Alternatively, double-click on the shortcut icon of Code Blocks on the desktop.

capture9

On Ubuntu, we can open Code Blocks from the terminal by issuing the following command.

Code Block will now ask us to select default Compiler. Code Block supports several compilers from different vendors. If our computer has some other compiler in addition to GCC, Code Blocks will detect all of them and will show us a list in the window. This computer does not have any compiler except GCC, that’s why only GCC is detected. Select the GCC compiler and click on “Set as default” as shown in the screenshot below:

capture10

Click OK to continue and we will find ourselves inside the home screen of the CodeBlocks IDE.

capture11

In the next post, we will create our first C program.

If you want to learn about micro-controllers and other electronics projects, I would ask you to visit our YouTube channel and subscribe to receive continuous notifications. You can also subscribe to our Newsletter below to get email notification of each post as and when they are posted.

You can also follow us on social media platforms such as  Facebook and Twitter.

Thanks a lot for reading through this post. Feel free to follow through this series and comment your queries in the comment box below. Also feel free to contact us regarding any out of stock product and we will try to get back to you as soon as possible.

 

Leave a Reply