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.
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:
Now Click on “Console Application” and hit the “Go” button.
Then click next until you get to the Language Selection Dialog as shown below:
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:
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:
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:
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.
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.