Let's see how to configure and set up environment variables for MinGW GCC C Compiler in a Windows Operating System in order to run our first C program.
Open the folder where the MinGW is installed.
Next, open the bin folder in the MinGW folder and copy the path to this folder.
In our case, we have installed MinGW in its default directory C:\MinGW, hence the path of our bin folder in JDK
Next, in the search box of the Windows Operating System(Windows 7 to Windows 10), type in windows command sysdm.cpl and press Enter to open the window of System Properties.
The next window of System properties open up, we need to click on its tab Advanced.
In this tab Advanced, we need to click on the Environment Variables , in order to set the environment variables for executing Java programs.
In the next window of Environment Variables, we need to click on Path variable in the section of System variables
and then click on Edit button to edit the value of this Path System variable.
As we clicked on the Edit button to edit the value of Path System variable,
a new window of Edit System Variable opens up with two options Variable name and Variable value.
Against the box of Variable value, we need to paste the path to the bin folder of MinGW
Next, click the OK button to save the new value of Path System variable.
Next, click the OK button on the previous window of Environment Variables .
Next, in the search box of the Windows Operating System(Windows 7 to Windows 10), type in the windows command cmd and press Enter to open the a windows Command Prompt.
In the Command Prompt window, we will check whether MinGW GCC C Compiler is successfully installed and running in our system. To do this, we type a command gcc --version which calls the MinGW GCC C Compiler and
press Enter and voilà! MinGW GCC C Compiler responds and we are shown its installed version on our system.
This concludes a successful setup of the environment variables of MinGW GCC C Compiler to compiler and execute our C programs.
Next in, executing our first C program.