- 1 year ago
GCC/G++-11 on windows
Comment
1 / 1
GCC (GNU Compiler Collection) and G++ (GNU C++ Compiler) versions 11 and above are not officially available for Windows. However, you can use the MinGW-w64 project to obtain GCC and G++ versions that support C++11 and later standards on Windows. Here's how you can set up GCC/G++-11 on Windows using MinGW-w64:
Install MinGW-w64:
- Visit the MinGW-w64 website: https://mingw-w64.org/doku.php
- Download the appropriate version of the MinGW-w64 installer based on your system architecture (32-bit or 64-bit).
- Run the installer and follow the installation instructions. During the installation, make sure to select the desired components, including the GCC and G++ compilers.
Update the Environment Variables:
- After the installation, add the MinGW-w64
bin
directory to your system'sPATH
environment variable. This ensures that you can access the GCC and G++ commands from any location in the command prompt. - Open the Windows Start menu, search for "Environment Variables," and select "Edit the system environment variables."
- Click the "Environment Variables" button.
- Under the "System variables" section, find the
PATH
variable and click "Edit." - Add the path to the MinGW-w64
bin
directory (e.g.,C:\mingw-w64\mingw64\bin
) at the beginning of the variable value. Separate multiple paths with semicolons. - Click "OK" to save the changes.
- After the installation, add the MinGW-w64
Verify GCC/G++ Installation:
- Open a new command prompt window and run the following commands to verify that GCC and G++ are installed correctly and accessible:css
gcc --version
g++ --version
- If the commands display the versions of GCC and G++, the installation was successful.
- Open a new command prompt window and run the following commands to verify that GCC and G++ are installed correctly and accessible:
With these steps, you should have GCC and G++ (version 11) installed on your Windows system using MinGW-w64. You can use these compilers to compile and run C and C++ programs that utilize the C++11 and later standards.