c++gdbg++mingwmingw-w64

How to add MinGW to PATH?


I'm following this tutorial by vscode to install a C++ compiler on Windows. Right now, I'm trying to edit C:\msys64\mingw64\bin to environment variables and save MinGW to path. I clicked OK multiple times but seems like it can't save. I also entered g++ --version and gdb --version to check for installation. It just shows "'g++' is not recognized as an internal or external command, operable program or batch file."


Solution

  • If reinstalling MinGW doesn't work, add MinGW to PATH manually by this:

    1. Find your computer's property, and then go to Advanced.
    2. Click Alt+N
    3. Find PATH in the box below.
    4. Add the path of your MinGW compiler to it. Note: Add the BIN folder.

    If adding the BIN folder doesn't work, add the BIN folder in the folder under C:\msys64\mingw64 that has a long name like this:

    x86_64-w64-mingw32 
    

    or whatever your folder is named.

    IMPORTANT NOTE: REMEMBER TO RESTART YOUR COMPUTER AFTER DOING THIS.