Hello There! ![]()
-
First, search and install C/C++ extension from Anysphere (cursor.com) in the Cursor marketplace.
- Search for and install the clangd extension from llvm-vs-code-extensions (llvm.org).
-
From MSYS2 Website, download the required version for your device (x86 or ARM64)
-
Install the application by clicking Next for all steps (leave the recommended path as
C:\msys64). -
Run the following command in the terminal that opens.
(If it is not open, search for “MSYS2 UCRT64” in the Windows search bar and open it.)
pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain
Accept the default by pressing Enter.
Then enter
Ywhen prompted whether to proceed with the installation.
-
Add the path of your MinGW-w64
binfolder to the WindowsPATHenvironment variable. -
- In windows search bar Search for Edit environment variables for your account.
- In your User variables, select the
Pathvariable and then select Edit. - Click New and add the MinGW-w64 destination folder you selected during installation.
If you used the default settings, the path will beC:\msys64\ucrt64\bin. - Select OK, and then select OK again in the Environment Variables window to update the
PATHenvironment variable.
-
Check your MinGW installation
- Open Command Prompt (CMD) and run:
gcc --version
g++ --version
gdb --version
- You should see version information displayed.
If your terminal cannot find any of these commands, run the appropriate command in MSYS2 UCRT64 (after reopening it):
# Use this command and check after in cmd.
pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain
#If the problem persists.
# try this for gdb
pacman -S mingw-w64-ucrt-x86_64-gdb
#try this for gcc and g++
pacman -S mingw-w64-ucrt-x86_64-gcc
- In MSYS2 UCRT64, run:
pacman -S mingw-w64-ucrt-x86_64-clang
pacman -S mingw-w64-ucrt-x86_64-clang-tools-extra
Enter
Ywhen prompted whether to proceed with the installation.
- Create a project folder.
- Inside the project folder, create a folder named
.vscode - inside
.vscodefolder create 3 fileslaunch.json|tasks.json|settings.json - Copy the code below and paste it into your correct files.
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug (MSYS2 UCRT64)",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:/msys64/ucrt64/bin/gdb.exe",
"preLaunchTask": "Build with MSYS2 Clang (UCRT64)",
"setupCommands": [
{
"description": "Enable pretty-printing",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "Build with MSYS2 Clang (UCRT64)",
"type": "shell",
"command": "C:/msys64/ucrt64/bin/clang++.exe",
"args": [
"-g",
"-std=c++20",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": ["$gcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
settings.json
{
"clangd.path": "C:/msys64/ucrt64/bin/clangd.exe",
"clangd.arguments": [
"--background-index",
"--clang-tidy",
"--completion-style=detailed",
"--header-insertion=iwyu"
],
"terminal.integrated.env.windows": {
"PATH": "C:/msys64/ucrt64/bin;${env:PATH}"
}
}
Now create your C/C++ files and Enjoy!




