Home > Blockchain >  Windows not recognizing g or gcc
Windows not recognizing g or gcc

Time:09-23

I downloaded the MinGW compiler for c and c , I executed the installer and added the MinGW bin directory to the environment variables.

enter image description here

After that I tried to execute g --version on the cmd and I got the following error:

'g ' is not recognized as an internal or external command, operable program or batch file.

I have closed and opened again the cmd and restated my computer but the error persists.

CodePudding user response:

System variables are basically globally set variables which all have different meaning to the system. The Path variable is what you want to take a closer look at, as it is the Variable which is queried by the console whenever you type a programs name into the prompt. It will look into all direcories specified in the value of the Path variable and search for the program you entered.

So it doesn't really help if you create MinGW as a custom variable. What you want to do is add your path c:\MinGW\bin to the Path variable.

I'd recommend a reboot after that to make sure, the changes take effect.

CodePudding user response:

You're adding the directory to the system variables, which are global and cannot be changed by any user. They are set by Windows itself, and any other programmes or drivers installed. Instead, you should be adding C:\MinGW\bin to the user variables right above the system variables in the Environment Variables. Specifically, the value should be added to the Path variable (see this screenshot).

  •  Tags:  
  • c
  • Related