vscode windows下 tasks.json 和 launch.json

tasks.json

bash 复制代码
{
    "tasks": [
        {
            "type": "shell",
            "label": "g++ build active file",
            "command": "C:\\Program Files\\mingw64\\bin\\g++.exe",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "C:\\Program Files\\mingw64\\bin"
            }
        },
        {
            "type": "cppbuild",
            "label": "C/C++: g++ 生成活动文件",
            "command": "C:\\Program Files\\mingw64\\bin\\g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build",
            "detail": "编译器: C:\\Program Files\\mingw64\\bin\\g++.exe"
        }
    ],
    "version": "2.0.0"
}

launch.json

bash 复制代码
{
    // 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": "g++ - 生成和调试活动文件",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "C:\\Program Files\\mingw64\\bin",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "g++ build active file",
            "miDebuggerPath": "C:\\Program Files\\mingw64\\bin\\gdb.exe",
        }
    ]
}
相关推荐
软件资深者2 小时前
千千静听典藏修复版 使用教程:经典本地音乐播放器回归,歌词同步、皮肤皮肤自由换,音乐播放器怀旧新手 5 分钟上手(2026)
windows
captain3763 小时前
文件与IO(2)
java·开发语言·windows·java-ee
星栖与芯4 小时前
# STM32MP157+LiteOS-M GCC极简工程:启动源码适配+Windows Make终极避坑
windows·stm32·单片机
AI视觉网奇5 小时前
图片转矢量图 算法总结
windows
清水白石0085 小时前
Python dataclass 高级避坑指南:从 default_factory、frozen、slots 到哈希灾难
windows·python·哈希算法
kaixin_啊啊5 小时前
Windows版ChatGPT启动失败Unable-to-locate-Codex-CLI-binary解决方法
windows·chatgpt
零号栈帧6 小时前
Codex 手机控制台——AgentDeck
windows·cloudflare·codex·pwa·ai agent
时光慢煮6 小时前
开源鸿蒙PC上手体验:从 Windows 和 macOS 切换过来,我被惊艳到了
windows·开源·harmonyos
J.T.L7 小时前
Windows 10/11 本地/微软账户密码遗忘:终极自救
windows·microsoft
zx_741484817 小时前
【深度学习入门】Windows 下 PyTorch GPU 环境搭建
pytorch·windows·深度学习