This config has allowed me to debug Blender in VS Code
.vscode/launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug Blender",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/../build_windows_x64_vc16_Debug/bin/Debug/blender.exe",
"args": [], // You could place a .blend file path here to open it by default, or any other Blender args
"stopAtEntry": false,
"cwd": "${workspaceFolder}/../build_windows_x64_vc16_Debug/bin/Debug",
"environment": [],
"externalConsole": false, // This could be set to true if you prefer an external console for debugging
"preLaunchTask": "Build Blender" // Optional; you can use if you want it to build before launching
}
]
}
.vscode/tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build Blender (Release)",
"type": "shell",
"command": "make release",
"group": "build"
},
{
"label": "Build Blender (Developer)",
"type": "shell",
"command": "make developer",
"group": "build",
"problemMatcher": [
"$gcc"
]
},
{
"label": "Build Blender",
"type": "shell",
"command": "make debug",
"group": "build",
"problemMatcher": [
"$gcc"
]
}
]
}
If you’re using an alternative shell by default you’ll potentially also want to add this line to settings.json which will open cmd terminals within the Blender project.
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe"