vscode debug各种文件配置

博客记载了目前使用的vscode编辑器,debug程序是launch.json,settings.json和tasks.json的配置。

#launch.json
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",                                 //配置名称,会在启动配置的下拉菜单中显示
            "type": "cppdbg",                                       //配置类型,只能为cppdbg
            "request": "launch",                                    //请求类型,可以为launch或attach
            "program": "${workspaceFolder}/run",             //将要调试的程序的路径
            "args": ["0105"],                                             //调试时传递给程序的命令行参数
            "stopAtEntry": false,                                   //设为true程序会暂停在入口处
            "cwd": "${workspaceFolder}",                            //调试程序时的工作目录
            "environment": [],                                      //环境变量
            "externalConsole": true,                                //调试时是否显示控制台窗口
            "MIMode": "gdb",                                        //指定连接的调试器,可以为gdb或lldb
            "miDebuggerPath": "/usr/bin/gdb",                       //gdb路径
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "build"                                //调试开始前执行的任务,一般为编译程序
        }
    ]
}



```python
#tasks.json
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build", //在launch.json文件中有用到
            "type": "shell",
            "command": "g++",
            "args": [
                "-g", "-std=c++11","main.cpp"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

发布了13 篇原创文章 · 获赞 1 · 访问量 586

猜你喜欢

转载自blog.csdn.net/qq_34929889/article/details/105158243
今日推荐