How to install C and C++ on Windows ?
In this article we we will show you how to install C and C++ on windows. Unlike python and other languages, installing the C compiler on Windows is not an easy task. For languages like python, you can just download the latest installer from the official website and install it like any other normal program. For C and C++ it is not as straight forward. Usually people download and install the compiler separately and then an ide or text editor to actually write and run code. We will show you another simple way to get C and C++ working on your computer. The easiest way to install the C and C++ compiler is to install it along with an ide like Codeblocks.
Downloading CodeBlocks
Codeblocks is a free and open source ide for C and C++. We can make CodeBlocks automatically install the C compiler for you. We will show you how to do that.
First download CodeBlocks from here.
Download only the codeblocks version with mingw included. Here I am downloading codeblocks-20.03mingw-setup.exe . I recommend that you also download the same. To download the file you can click on either FossHUB or Sourceforge.net link. I am downloading from FossHUB. Once you click on the FossHUB link next to codeblocks-20.03mingw-setup.exe, a new tab will open and download will automatically start.
Installing CodeBlocks
Open the file you just downloaded.
In the first screen, click on next. In the second screen, click on I Agree, in the third screen click Next, and on the fourth screen, you can choose the directory in which CodeBlocks will be installed. After that click on install to begin the installation. Now CodeBlocks installer will install the CodeBlocks ide and also the C/C++ compiler.
After installation is completed click yes to run CodeBlocks now.
In this screen, select GNU GCC Compiler and click ok.
That’s it , CodeBlocks is successfully installed and configured.
Now let’s create a sample Helloworld C++ program to test our installation.
Creating a C++ Program in CodeBlocks
Click on create a new project and choose Console Application on the next screen. Then choose which language you want to use. Here we are choosing C++ since we are making a C++ program.
On the next screen give a name for your project and also choose the folder where you want to save your project.
Click on next and then finish to create your project.
You will see that CodeBlocks has already created a sample helloworld code for our project. You can modify or replace it as you want.
To run your code, click on the build and run button. You will see the output on a new window.
In this article we showed you how to install C and C++ on windows.
In the next article we will show you how to configure VS Code for C and C++.