1

Using windows 10 and trying to set vs code, I installed MinGW with the package mingw32-gcc-g++-bin; modified the windows path adding the line ";C:\MinGW\bin" and mi json file looks as follow:

{ "name": "Win32", "includePath": [ "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503/include/*", "C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/um", "C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/ucrt", "C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/shared", "C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/winrt", "C:/MinGW/bin", "${workspaceRoot}", "${workspaceFolder}" ], "defines": [ "_DEBUG", "UNICODE" ], "compilerPath": "C:/MinGW/bin/g++", "intelliSenseMode": "msvc-x64", "browse": { "path": [ "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503/include/*", "C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/um", "C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/ucrt", "C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/shared", "C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/winrt", "C:/MinGW/bin", "${workspaceRoot}", "${workspaceFolder}" ], "limitSymbolsToIncludedHeaders": true, "databaseFilename": "" } } 

I also tried calling g++ from cmd terminal but it fails nonetheless with "g++ is not recognized as an internal or external command..."

2
  • Is that a config jsom of a visual stutio code project? Add more context please. Commented Mar 10, 2019 at 11:23
  • 2
    Have you tried restarting your command line after setting PATH? Commented Mar 10, 2019 at 11:29

1 Answer 1

1

"g++ is not recognized as an internal or external command" means g++ cannot be found in PATH. Either the program was not installed correctly, or the PATH is not correctly set.

First check that g++ really is in PATH. Open a new terminal and write g++. If the error message is there, do

cd C:\MinGW\bin g++ 

. Windows does not only search in the PATH-variable, but also in the current directory. if the error message is still there, then g++ is not to be found there (can you see g++.exe in file explorer for the current path?). If the error message is gone and the application starts (but is complaining about missing arguments) path is not correctly set. Check path variable by doing

echo %PATH% 

and verify that C:\MinGW\bin is missing. Add it locally firstly, and try to execute g++ from another directory: set PATH=%PATH%;C:\MinGW\bin cd .. g++ we are now calling g++ from the parent folder, which should now work, as g++ is now successfully found in PATH. Note however that this is a local PATH and it will only be found for the current command prompt.

Add g++ to path either for user or globally: https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/

After adding the variable as in the link, restart the terminal and try executing g++ again, but this time successfully. Restart Visual Studio Code to reload path variables and the program should be able to find g++ as well.

Sign up to request clarification or add additional context in comments.

1 Comment

The mistake was that I changed path in the upper box instead of the lower one; after adding it globally it works! Thank you very much

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.