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
is C:\MinGW\bin
Figure 1
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.
Figure 2
The next window of System properties open up, we need to click on its tab Advanced.
Figure 3
In this tab Advanced, we need to click on the Environment Variables , in order to set the environment variables for executing Java programs.
Figure 4
Advertisement
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.
Figure 5
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.
Figure 6
Next, click the OK button on the previous window of Environment Variables .
Figure 7
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.
Figure 8
.
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.
Figure 9
.
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.