If you have installed MinGW tools on your system and are trying to run gcc from command prompt, you might get this error – 'gcc' is not recognized as an internal or external command. This post explains how we can fix this problem once for all.
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\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;c:\Program Files\Java\jdk1.7.0_79\bin;C:\Program Files (x8 6)\Skype\Phone\;C:\Program Files (x86)\Quarantine\;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Windows Resource Kits\Tools\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\ Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;c:\Program F iles\Java\jdk1.7.0_79\bin;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\Quarantine\;c:\Program Files (x86)\Mozilla Firefox"
If you have such a long path like in my case, use findstr to quickly check if it has mingw anywhere in the string.
c:\>set path | findstr /I /C:"mingw" c:\>
After doing the above steps, open a new command prompt and run gcc to compile a C program.
c:\>type helloWindows.c
#include
int main() {
printf("Hello Windows");
}
c:>
c:\>gcc -o HelloWindows.exe helloWindows.c
c:\> HelloWindows.exe
Hello Windows
That completes the setup. Before I end the post, reiterating couple of important points.
1. Add path to system environment variable, not user environment variable.
2. Open a new command window after setting PATH.
Let us know if this post helped you to fix the problem. If you still have issues, please add to the comments the error you are getting into. We would do our best to reply and help you fix the problem.
Adding users from command line is much easier than going through the UI. It saves…
Do you want to delete a directory from Windows command prompt(CMD)? This post explains how…
We can kill a process from GUI using Task manager. If you want to do…
Chrome is definitely the stable browser compared to other ones and it has been my…
Windows has multiple command line utilities that can help find the version of the Windows…
There are multiple ways to check whether a Windows computer is running 32-bit OS or…
View Comments
Good Stuff here, could be useful for future reference, thanks for posting
plz help me to how can i play a .mp3 file from turbo c compiler when i execute it in turbo c
.also i know about sound function but that function works on some frequency range ..but i want the song should get imported and is played when i press CTRL+f9.
And i have also used System calls to do this but not suceeding.
my system configuration is:-
32- bit operating system
Thank you so much for this post. Helped a lot. Especially the last two points.
Thank you very much for this post. It solved my problem.
Emirali
I can not edit system variables. I can't select the button edit.
I can see MinGW in the path but it still says not recognized! I double checked my path and it is 100 % correct. What could the issue be?
Same problem. Have the path added to system level, user level and mingw copied to a directory path with no spaces in it (programfiles 86 has a space and sometimes spaces in paths are a problem).
same problem
This fixed it right up make sure not to mix up user and enviornment variables.
I'm getting gcc no such file or directory. why?
I get the same output, let me know if you figure out why, thanks, and all the best
I can see MinGW in the path but it still says not recognized! I double checked my path and it is 100 % correct. What could the issue be?
Maybe the mingw is installed in another drive or folder, so ,if you can add it in current folder, error may not be there. Hope it helps.
I had this problem too when I was looking through the mingw files I noticed theres nothing in the bin directiory. I looked in the other folders and found a bin folder with the correct contents it was called ucrt64\bin.
For me it works now
sir, it worked. But still having problem while running c++ program. I guess there is different command for c++. Please help me.