Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MinGW: "gcc is not recognized as an internal or external command"

Tags:

I downloaded and installed MinGW. I used the graphical program to install the C++ compiler.

Typing gcc in the Windows command line prints:

gcc is not recognized as an internal or external command 

I checked, and gcc.exe is present in C:\MinGW\bin. What's wrong?

like image 620
Aviv Cohn Avatar asked Oct 10 '14 17:10

Aviv Cohn


People also ask

How do I fix GCC is not recognized as an internal or external command?

Looks like the answer is in here. Because you don't have the uri path to the MinGW\bin directory, your machine can't recognize gcc . You have to add it to the Path environment variable in your system. You can get to environment variables by just typing environment variables in the Windows search box in your taskbar.

How do I fix g ++ not recognized?

You need to set the environment PATH to include the directory of mingw's bin directory if you want o use gcc.exe or g++.exe in cmd . run 'path' or 'echo %PATH% in cmd.exe prompt. Check the path carefully.


2 Answers

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:

enter image description here

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

After that, simply type in gcc -v.

Hope this helps anyone with the problem I had!

like image 142
user7943 Avatar answered Sep 17 '22 16:09

user7943


Or at the command line you must type in "\mingw\bin\gcc" instead of just "gcc". Best to set the environment as mentioned above.

like image 32
Gavin Simpson Avatar answered Sep 16 '22 16:09

Gavin Simpson