c++ - Installing the latest version of mingw-w64 on Windows - Stack Overflow
MinGW-w64 - for 32 and 64 bit Windows installer not available
How to Set Up C/C++ on Windows (Compiler + Debugger) the Easy Way In Vs Code
FINALLY an easy way to install GCC/MinGW on windows thanks to WinLibs.com
Videos
Factsheet
GCC 10 is officially released. The personal build for Windows (MinGW-w64) that can be downloaded from https://winlibs.com requires no installation, just extract to a folder.
Building GCC on Windows from source code is very difficult and cannot be recommended to beginners. Moreover, GCC 10 has not yet been officially released and you may need to wait a few more weeks to get it.
If you want an up-to-date GCC in Windows (currently version 9.3), I recommend downloading and installing the MSYS2 package. Once you install it, launch it using the "MinGW64" icon and install the correct compiler in the terminal. For details, see this question: How to install MinGW-w64 and MSYS2?
Once you have done this, you can forget about MSYS2 and simply use the directory with the binaries in your PATH.
The maintainers of MSYS2 are very keen in supporting bleeding edge software, so once GCC 10 is released, you will be able to update to it (using the command pacman -Syu)
very soon.
Hi,
Is anyone else experiencing problems to download the above from sourceforge: https://sourceforge.net/projects/mingw-w64/.
The documents I follow all state that the downloaded file should be an exe but in this case I download a zip with source documents.
Under Files I found the installer (mingw-w64-install.exe) but after it starts it return an error that requirments.txt cannot be downloaded.
If you are new to C/C++ and want to: - Run C/C++ programs on Windows -
Use VS Code - Debug step-by-step (see variable values change)
This guide is for you.
You do NOT need MSYS2. This is a simple method.
------------------------------------------------------------------------
WHAT WE ARE INSTALLING
We need two things: 1. Compiler -> Converts C/C++ code into a program 2.
Debugger -> Lets you run code step-by-step
We will install both together using MinGW-w64.
------------------------------------------------------------------------
STEP 1: Download the Compiler (GCC + GDB)
Go to: https://www.winlibs.com/
Scroll to Downloads. Download the latest Win64 ZIP archive (for 64-bit
Windows).
This includes: - gcc (C compiler) - g++ (C++ compiler) - gdb (debugger)
------------------------------------------------------------------------
STEP 2: Extract the Files
Extract the downloaded ZIP file.
Move the extracted folder to:
C:
Check inside:
C:
You should see: - g++.exe - gcc.exe - gdb.exe
------------------------------------------------------------------------
STEP 3: Add to Environment Variables
Press Windows + S
Search: Environment Variables
Click “Edit the system environment variables”
Click “Environment Variables”
Under User variables, select Path
Click Edit
Click New
Add:
C:
Click OK and restart your PC.
------------------------------------------------------------------------
STEP 4: Test Installation
Open Command Prompt and type:
g++ –version gdb –version
If both show version information, installation is successful.
------------------------------------------------------------------------
STEP 5: Install VS Code
Download from: https://code.visualstudio.com/
Install the extension: C/C++ (by Microsoft)
------------------------------------------------------------------------
STEP 6: Run Your First C++ Program
Create a file: main.cpp
Paste:
#include using namespace std;
int main() { int a = 5; int b = 10; int sum = a + b; cout << “Sum is:”
<< sum << endl; return 0; }
Compile and run:
g++ main.cpp -o main main
You should see: Sum is: 15
------------------------------------------------------------------------
STEP 7: Debug Step-by-Step
Click left side of a line to add a breakpoint (red dot).
Press F5.
Use: F10 -> Next line F11 -> Step into function
You can now: - Watch variable values - Understand how code runs - Learn
stack, queue, recursion, BFS properly
------------------------------------------------------------------------
This method is simple, clean, and perfect for beginners learning C/C++
on Windows with VS Code.
task.json
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc.exe build active file",
"command": "C:\\mingw32\\bin\\gcc.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}