Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"g++" is not recognized as an internal or external command, MinGW

Tags:

On my computer I have Windows 7 x86. I installed MinGW, I wrote the path but when I go in cmd.exe and write g++ -v it says:

"g++" is not recognized as an internal or external command. 

But when I write the make -v command it recognizes it. I need this for school, I work in Eclipse, I even installed the latest java(I saw it must be installed).

like image 899
user1274566 Avatar asked Mar 16 '12 17:03

user1274566


People also ask

How do I fix G is not recognized as an internal?

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.

Why G ++ is not recognized vs code?

If you don't see the expected output or g++ or gdb is not a recognized command, make sure your PATH entry matches the Mingw-w64 binary location where the compilers are located. If the compilers do not exist at that PATH entry, make sure you followed the instructions on the MSYS2 website to install Mingw-w64.

Does MinGW contain g ++?

Mingw executables They also provide other compiler drivers, which in the case of mingw are executables such as g++, c++, g77, etc. These drivers invoke the appropriate compiler programs to compile your source code. Note that g++ and c++ are identical files except for the name difference.


2 Answers

Seeing that the make command works fine, I think you forgot to mark the mingw-gcc-g++ package in the MinGW Installation Manager.

Run the MinGW Installation Manager again and mark mingw-gcc-g++ for installation and press Apply Changes

like image 120
MichaelvdNet Avatar answered Oct 05 '22 00:10

MichaelvdNet


You have to modify environment variables. Do the following:

  • From the desktop, right-click Computer and click Properties.
  • From the Computer Properties window, click Change Settings
  • In the System Properties window which opens up, click on the Advanced tab.
  • In the Advanced section, click the Environment Variables button.
  • Finally, in the Environment Variables window (as shown below), highlight the Path variable in the Systems Variable section and click the Edit button. Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon as shown below.

    C:\Program Files;C:\Winnt;C:\Winnt\System32

Additionally you may refer to this link

like image 45
Vishwanath K R Avatar answered Oct 04 '22 23:10

Vishwanath K R