Reputation: 213810
The Mingw binary installation instructions (such as these) tells me to change the PATH
environment variable in Windows, in order to use the gcc
/g++
etc commands anywhere. This might also be necessary for some programming IDE to find the compiler. Failing to do so yields errors such as this:
'gcc' is not recognized as an internal or external command, operable program or batch file.
How do I do this specifically in newer versions of Windows (10/11) and which path should I use?
Upvotes: 3
Views: 12664
Reputation: 7345
Alternatively, for CLI
users:
cmd
.PATH
.bin
folder to it.And you're done.
Edit: For the full path to the bin
folder:
cd
your way to Mingw
installation's bin
folder, or alternatively, press windows key + e
.mingw
-> bin
.As @Lundin said, you should first make a copy of the original PATH
and save it, just in case something goes wrong.
Upvotes: 0
Reputation: 213810
PATH
in case of mistakes.;
at the end of the text there unless already present. Then after the semicolon add the full path to your Mingw installation's bin
folder. For example ;c:\mingw_w64\bin
.C:\program files\mingw_w64
, then the path must be ;C:\Program Files\mingw-w64\bin;
without any surrounding " ... "
. If using the "Edit" command available in this window, then the " ... "
will get added and this may break the gcc path from working. (It just happened to me and that's the reason why I decided to write this Q&A.)Now you should be able to type gcc
from the command line or use it from your programming IDE.
Upvotes: 4