How to install C and C++ | MinGW | Windows 10

How to download and install C and C++ in VS

install mingw

What are C and C++?

C and C++, are both high-level languages (HLL). C is a procedural or structured language while C++ is an Object-oriented programming language. C language was developed in 1970 by Deis Retchi at Bell labs, and C++ is a successor of C language developed by Bjarne Stroustrup in 1985.

What is MinGW?

MinGW formerly Ming32, is short for Minimalistic GNU for Windows. It is a free and open-source software development environment for developing Microsoft Windows applications. MinGW has a lot of libraries and header files that compile the C, C++, Fortran, ADA, etc code so that the GCC compiler present inside the Windows operating system can understand and then run that codes. 

How to install C and C++ in Visual Studio Code

You may also like:

How to install MinGW in Visual Studio Code

To install C and C++ on your Windows 10 machine using the MinGW compiler, follow the given instruction:

1st step: Download the MinGW manager and install it.

  • Visit the official MinGW website from here, and click on the download button to download the MinGW manager.
  • Double-click on the download file, and click on the install button.
  • Now on the second screen, click on the continue button. Don't change the default settings.
  • Wait for it to finish the download and installation, then click on the continue button.

2nd step: Download and install the required compiler from the given options inside MinGW.

  • Now on the MinGW installation manager, you will see packages with their details, click on the required package checkbox and then select mark for installation from the options.
  • After you have selected your required package, click on the installation option from the menubar and click on the apply changes option.
  • At the schedule of pending actions page, click on the apply button to initiate the downloading and installation process.
  • If everything goes right, you will see an applying scheduled changes page, and on that page click on the close button to complete the installation.

How to check if G++ is installed successfully

  • Open the command prompt in the following path: C: drive > MinGW > bin.
  • In the terminal write the command g++ --version.
  • It will show the g++ version, if not then try to reinstall the MinGW to fix it.

How to add MinGW to the path environment variable

Follow the given instruction to add MinGW to the path variable:
  • Open the following folder:- C: drive > MinGW > bin. Copy the path.
  • Open system properties by typing edit the system environment variables on your Windows search bar and click on the environment variable button.
  • In the system variables section, search for the path variable and click on the edit button.
  • Now click on the new button and paste the copied path on the edit environment variables page.
  • Finally, click on the ok button to save the changes, and open the CMD to check if everything goes right.

How to run a C/C++ program using GCC or G++ compiler

Always remember G++ is used to compile C++ programs and GCC compiler is used to compile C programs.
  • On the terminal write the following command to compile: gcc .\filename.c
  • It will generate an executable file, and write the following command to run it: .\filename.exe
This is how you can download and install MinGW as well as C and C++ compilers on Windows

I hope this article was helpful to you.
Thank you.

Comments

Popular posts from this blog

How to deploy a Nodejs server in Vercel | Node JS backend

How to deploy React app to Firebase Hosting | React frontend | Node backend on Vercel