vscode配置文件

需要配置以下三个文件(都可以通过新建文件的方式创建):

1.launch.json

2.settings.json

3.tasks.json


1.launch.json

一定要确保miDebuggerPath的路径正确

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}.exe",//这里是运行的.exe文件名称
            "args": [],//这里写传入命令行参数文本(main经常里面void的就不用写了)
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "targetArchitecture": "x64", 
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\gdb.exe",//写自己环境的gdb
            "preLaunchTask": "g++",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        },
    ]
}

2.settings.json

{
    "C_Cpp.errorSquiggles": "Enabled",//纠错
    "files.associations": {//文件关联
        "system_error": "c",
        "*.tcc": "cpp",
        "unordered_map": "cpp",
        "vector": "cpp",
        "array": "cpp",
        "initializer_list": "cpp",
        "utility": "cpp",
        "iostream": "cpp",
        "cmath": "cpp",
        "functional": "cpp",
        "tuple": "cpp",
        "istream": "cpp",
        "cctype": "cpp",
        "clocale": "cpp",
        "cstdint": "cpp",
        "cstdio": "cpp",
        "cstdlib": "cpp",
        "cwchar": "cpp",
        "cwctype": "cpp",
        "exception": "cpp",
        "fstream": "cpp",
        "iosfwd": "cpp",
        "limits": "cpp",
        "new": "cpp",
        "ostream": "cpp",
        "numeric": "cpp",
        "sstream": "cpp",
        "stdexcept": "cpp",
        "streambuf": "cpp",
        "type_traits": "cpp",
        "typeinfo": "cpp",
        "ctime": "cpp",
        "list": "cpp",
        "string": "cpp",
        "stdlib.h": "c",
        "math.h": "c",
        "stdio.h": "c"
    }
}

3.tasks.json

{
    "version": "2.0.0",
    "command": "g++",//执行命令
    "args": ["-g","-std=c++11","${file}","-o","${fileDirname}\\${fileBasenameNoExtension}.exe"],   // 编译命令参数
    "problemMatcher": {
        "owner": "cpp",
        "fileLocation": ["relative", "${workspaceRoot}"],//文件地址
        "pattern": {
            "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
        "file": 1,
        "line": 2,
        "column": 3,
        "severity": 4,
        "message": 5
        }
    }
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值