Setting up GCC with MinGW-w64 in Visual Studio Code on Windows 11 | C & C++ Programming

In this tutorial:

  • We will configure Visual Studio Code to use the GCC C++ compiler (g++) and GDB debugger from mingw-w64
  • Then we will create programs, and then compile, run, and debug a simple Hello World program.

Let’s begin:

Step 1: Open Visual Studio Code and install this plugin-
C/C++ extension for VS Code

Step 2: Installing the MinGW-w64 toolchain :
– Downloading latest version of MinGW-w64, which gives up-to-date native builds of GCC, MinGW-w64, and other helpful C++ tools and libraries.
– We will get the necessary tools to compile the code, debug it, and configure it to work with IntelliSense.

download link : https://github.com/msys2/msys2-installer/releases/download/2023-10-26/msys2-x86_64-20231026.exe

     run following command in terminal : pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain

Step 3: Add the path to your MinGW-w64 bin folder to the Windows PATH environment variable.

Step 4: Check your MinGW installation (working – sucessful)
**open cmd and type these commands:
gcc –version
g++ –version
gdb –version

Step 5: Creating Hello world program in Visual Studio Code. (we can run few commands and create project folder from cmd) lets do it.
mkdir projects
cd projects
mkdir helloworld
cd helloworld
code . (this command will open VS code and open our project folder.)

Step 6: Now select the New File button and name the file helloworld.cpp.
add some code in this file and Save.

Step 7: Running hello CoolITHelp program in Visual Studio Code

Please watch the video tutorial below for better understanding.


If you find this video tutorial useful, please hit like button to tell us, also you can subscribe to learn more and motivate us to create more technical videos for you.

Happy Coding! 🙂

Indian Visa For German Citizens

Indian Visa For USA Citizens

Leave a Comment