- 1 year ago
'g++' is not recognized in Windows 11
If 'g++' is not recognized
in Windows 11, it means that the g++ compiler is not installed or not properly configured in your system. To resolve this issue, you can follow these steps:
Install MinGW-w64: g++ is typically part of the MinGW-w64 (Minimalist GNU for Windows) distribution, which provides a collection of GNU tools for Windows. Visit the MinGW-w64 website (https://mingw-w64.org/doku.php) and download the installer for your system.
Run the MinGW-w64 installer: Once downloaded, run the installer and follow the installation instructions. During the installation process, you will have the option to select the components to install. Make sure to select the g++ compiler component.
Add MinGW-w64 to the system PATH: After installing MinGW-w64, you need to add its bin directory to the system PATH environment variable. This allows Windows to locate the g++ executable. Here's how you can add it:
- Open the Start menu and search for "Environment Variables."
- Select "Edit the system environment variables."
- In the System Properties window, click the "Environment Variables" button.
- In the "System Variables" section, scroll down to the "Path" variable and click "Edit."
- Add the path to the bin directory of your MinGW-w64 installation. The default installation path is
C:\mingw-w64\mingw64\bin
. Make sure to adjust the path if you installed it in a different location. - Click "OK" to save the changes.
Open a new command prompt: Close any existing command prompt windows and open a new one. This ensures that the updated PATH variable takes effect.
Verify g++ installation: Type
g++ --version
in the command prompt and press Enter. If g++ is properly installed and configured, it should display the version information.
By following these steps, you should be able to resolve the 'g++' is not recognized
error in Windows 11 and successfully use the g++ compiler for C++ development.