SETTING UP PATH VARIABLE

To set up the path for the C compiler for windows, follows the below steps :
Step 1: Copy the path of the MinGW bin.
When you install the MinGW, it creates a folder named MinGW in C: Drive. To set the compiler's path, we need the path to the bin directory of MinGW. So, first,

  • Go to C:>MinGW>bin.
  • Now, inside the bin folder, click on the address bar and copy the address.
  • We require this address to be set as the path in the environment variable.
  • If your install location was somewhere else, you may go to that location where you have installed MinGW.

Note: If you open command prompt directly in the bin path, the g++ --version command will work properly, but the command should work on all the directories in the computer. That is the main reason to set the environment path variable.

Step 2: Open Edit System Variables. Navigate to the search bar and type Edit the system environment variables and click on open to continue to edit system environment variables.

Step 3: Edit the Path. In the User variables for the User section, select the path and click on the Edit button.

Step 4: Setup a New Path.

  • After clicking on the Edit button, a new window, Edit environment variable will open. This window allows us to add the path as per our requirements.
  • Since we want to add a new path, click on the New button. A new window, Edit environment variable, will open. This window allows us to add the path as per our requirements. Click on the ' New ' button since we want to add a new path.

Step 5: Paste the Path. Paste the path of the MinGW bin that was copied earlier and click on Ok.