How to install or setup a free C and C++ compiler

Mr Coder August 3, 2012 7

Friends lets begin our first step towards learning C and C++ programming Language with Ccodechamps. Today we are going to teach you how to Install or setup free C and C++ compiler. This is the very first and mandatory step for new programmers, most of them usually face problems in installing an free C compiler. This tutorial will give you easy to follow instructions with snapshots, for setting a free compiler to compile C codes and Code blocks, which provide an environment to write code in C and C++ Languages. This tutorial explains you how to install code blocks on Windows XP, Windows Vista or Windows 7.

Steps to Install or setup free C and C++ compiler : Code Blocks

Step 1: Download Code Blocks

To download Code blocks : CLICK HERE

Step 2:  Double click the downloaded exe file to install the Code Blocks.

Step 3: Press Next Button 6 to 7 times until full installation completes. We assume that  you have installed Code Blocks in C:\Program Files\CodeBlocks (the default install location).

Note: You can install anywhere you as per your wish.

Step 4: Launch Code Blocks and Select Default Compiler

While running code blocks you will be see a pop up window showing compilers Auto-Detection Windows.

Select Default Compiler

When you get the compiler auto-detection window, just hit OK. Now Code Block will ask, if you want to associate it as the default viewer for C/C++ files, i will suggest just do it.

Now Click on the File menu, and under “New”, select “Project…”

The below Window will open:

Select Console Application

 

Now Click on “Console Application” and hit the “Go” button.

Then click next until you get to the Language Selection Dialog as shown below:

C Language Selection Window

Now you will be asked to select a Language C and C++, if you are not sure then select C++ as using C++ you can use both C and C++. Its up-to you what you want to choose.

After clicking “Next”, Code Blocks will then prompt, where you like to save the console application as shown below:

C Project Path

I will recommend you put it in its own folder, as it may create several files (this is especially true if you create other types of projects). You will need to give your project a name, anything will be fine.

Now Clicking “Next” again will prompt you to set up your compiler as shown below:

select compiler

You don’t need to do anything here. Just accept the defaults by hitting “Finish”.

You can now open the main.cpp file on the left as shown below:

code blocks cpp code

You may need to expand the contents of the “Sources” folder if you don’t see main.cpp.

At this point, you will have your main.cpp file, which you can modify if you like. For now, it just says “Hello World!”, so we can run it as is. Hit F9, which will first compile it and then run it.

C program Output

You now have a running program! You can simply edit main.cpp and then hit F9 to compile it and run it again.

We hope this guide for setting up C and C++ compiler is helpful to you Guys. If you have any issues ask us in form of comments.

7 Comments »

  1. Mr Coder August 15, 2012 at 7:12 pm - Reply

    testing…

    • Mr Coder August 15, 2012 at 7:12 pm - Reply

      multilevel testing…

      • Mr Coder August 15, 2012 at 7:12 pm - Reply

        third level testing…

  2. Mr Coder August 15, 2012 at 7:13 pm - Reply

    Normal second comment testing…

  3. key2 October 1, 2012 at 8:34 am - Reply

    It’s a nice post.

  4. Micha Peduzzi November 6, 2012 at 6:18 pm - Reply

    Having read this I believed it was really enlightening. I appreciate you spending some time and effort to put this article together. I once again find myself spending way too much time both reading and leaving comments. But so what, it was still worth it!

  5. AKSHAY December 4, 2012 at 4:55 pm - Reply

    sir
    i am new to code block IDE. i have installed it but when i run my first program in main.cpp, id doesnt get compiled. an error saying”"HELLO1 – Debug” uses an invalid compiler. Probably the toolchain path within the compiler options is not setup correctly?! Skipping…
    “HELLO1 – Debug” uses an invalid compiler. Probably the toolchain path within the compiler options is not setup correctly?! Skipping…
    Nothing to be done.” is coming. what should i do to fix this problem. I really want to use this IDE as soon as possible. Help me plz

Leave A Response »