Although an old question, none of the answers here helped me. The only route I found to get to my destination is by typing in the following line in my command prompt:

set Path=C:\MinGW\bin;%PATH%

After that, simply type in gcc -v.

Hope this helps anyone with the problem I had!

Answer from user7943 on Stack Overflow
🌐
CodeWithHarry
codewithharry.com › blogpost › solved-gcc-not-recognized-error-windows
[Solved] gcc: The term 'gcc' is not recognized as the name of a cmdlet, function... | Blog | CodeWithHarry
Facing the 'gcc is not recognized' error in your Windows system? This comprehensive guide provides step-by-step solutions to resolve the issue, including installing MinGW and setting up environment variables. Follow these simple steps to ensure a seamless coding experience with gcc.
🌐
Bobby Hadz
bobbyhadz.com › blog › gcc-is-not-recognized-as-an-internal-or-external-command
gcc is not recognized as an internal or external command | bobbyhadz
April 4, 2024 - The term 'gcc' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
🌐
Windows Command Line
windows-commandline.com › gcc-not-recognized-internal-external-command
GCC is not recognized as internal or external command
May 21, 2016 - This post explains how we can fix this problem once for all. The first step is to check what all you have in your PATH environment variable. Run set path and verify this. c:\>set path Path=C:\Program Files (x86)\Windows Resource Kits\Tools\;C:\WINDOWS\system32;C:\Program Files\Intel\WiFi\b...
Top answer
1 of 4
5

Hey,,, It will work for you I believe

Blockquote

  1. First: open the link: https://www.msys2.org/
  2. Go to the installation and download the installer .. install the exe file.
  3. search mingw in windows search(windows start)
  4. there is an app named--> MSYS2 MinGW {64/32}-bit
  5. run it as administrator
  6. Found command shell ---> type: pacman -Syu
  7. Will ask you for some installation click on Y
  8. Then again go to the same app MSYS2 MinGW {64/32}-bit and run as admin
  9. and write--> pacman -Ss gcc (in shell that opend after click)
  10. after clicking there will be bunch of things and now you have to care about your windows arch.. if it is 64 bit then write---> pacman -S mingw-w64-x86_64-gcc (and if its 32 you will find something like that where 64 will replaced by 32 in bunch of commands that are showing in your shell)
  11. after executing this command gcc will be installed in your system to check write: gcc --version || g++ --version
  12. After that to install the debugger write pacman -S mingw-w64-x86_64-gdb
  13. to check write: gdb --version

**Every thing got installed in your system now find the mingW file or mysys2 file on C drive(whereever you r mingW file got saved) go the the minGW 64 || 32 accroding to your operating system there is a bin folder click on that and copy the path inside the bin folder and save it in environment variables path **

Blockquote

Enjoy vs code

2 of 4
4

Works perfect in Visual Code. You need the following:

  • C/C++ extension in Visual Code.
  • msys64 installed in C:\
  • Add path to msys64 bin folder in environment variable

Instructions:

https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools

Important the msys64 path doesn't contain spaces so don't install it in Program Files.

You can search "Edit system environment variables" from the windows button, press button Environment Variables, and then add it as a System variable "Path". For me its located in

C:\msys64\mingw64\bin
Find elsewhere
🌐
Dnwkt
dnwkt.com › admin › upload › files › dc6fc4b9-0e25-4284-ac95-431246fa4514.pdf pdf
Untitled
The error "'gcc' is not recognized as an internal · or external command,operable program or batch file" occurs for 2 main reasons:gcc (GNU Compiler Collection) is not installed on your machine.The path to the MinGW binary is not added to your PATH environment variable.Depending on if you run ...
🌐
GitHub
github.com › formulahendry › vscode-code-runner › issues › 251
Can't build: 'gcc' is not recognised as... · Issue #251 · formulahendry/vscode-code-runner
February 10, 2018 - [Running] cd "c:\Users\Samuel\Documents\Programming\Test Again" && gcc main.c -o main && "c:\Users\Samuel\Documents\Programming\Test Again"main 'gcc' is not recognized as an internal or external command, operable program or batch file.
Author   formulahendry
Top answer
1 of 2
4
  • Right-click "My Computer"/"This PC" from Windows explorer and pick properties. Alternatively Windows key + X and click "System". An "About" window appears.
  • Scroll down to "Advanced system settings" and click on it.
  • Click on the "Environment Variables" button.
  • Select "Path" in the window that appears and click the edit button.
  • Click on "Edit text" (not on "Edit"!).
  • Before modifying anything, I strongly recommend to copy the text there and save it in a text file for backup, so that you can restore the PATH in case of mistakes.
  • Write a semicolon ; 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.
  • Important: if you installed Mingw under for example 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.)
  • Click OK for each open window.
  • Reboot Windows.

Now you should be able to type gcc from the command line or use it from your programming IDE.

2 of 2
0

Alternatively, for CLI users:

  1. Open cmd.
  2. Type PATH.
  3. Add the absolute path to the bin folder to it.
  4. Place a semi-colon at the end.
  5. Press enter.
  6. Reboot.

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.
  • Open mingw -> bin.
  • Copy the full path present in the search bar.

As @Lundin said, you should first make a copy of the original PATH and save it, just in case something goes wrong.

🌐
Sololearn
sololearn.com › en › Discuss › 2943715 › gcc-is-not-recognized-as-an-internal-or-external-command-operable-program-or-batch-file
"gcc is not recognized as an internal or external command ...
Sololearn is the world's largest community of people learning to code. With over 25 programming courses, choose from thousands of topics to learn how to code, brush up your programming knowledge, upskill your technical ability, or stay informed about the latest trends.
🌐
YouTube
youtube.com › the code city
Fix "GCC not Recognized as Internal or External Command" in VSCode/Terminal (2023) - YouTube
In this video, I'll show you how you can fix the "gcc not recognized as internal or external command" in vscode in your windows machine. This can be because ...
Published   December 4, 2023
Views   1K
🌐
Reddit
reddit.com › r/learnpython › 'gcc' is not recognized
r/learnpython on Reddit: 'gcc' is not recognized
June 9, 2020 -

I have been running my script on sublime text and I got the error message "'gcc' is not recognized as an internal or external command, operable program or batch file."

I tried running the same script on visual studio code and it worked fine. What is happening here?

🌐
YouTube
youtube.com › watch
The term 'gcc' is not recognized as the name of a cmdlet, function SOLVED in Visual Studio Code - YouTube
How to solve gcc : The term 'gcc' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or i...
Published   October 22, 2022