vscode在win10 / linux下的.vscode文件夹的配置 (c++/c)

系统方面配置自行查找

linux:

launch.json

{
    // 使用 IntelliSense 了解相关属性// 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0","configurations": [
        {
            "name": "(gdb) Launch","type": "cppdbg","request": "launch","program": "${workspaceRoot}/${fileBasenameNoExtension}.out","args": [],"stopAtEntry": false,"cwd": "${workspaceFolder}","environment": [],"externalConsole": true,"MIMode": "gdb","setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb","text": "-enable-pretty-printing","ignoreFailures": true
                }
            ],"prelaunchTask": "build"
        }
    ]
}

tasks.json

{
    "version": "2.0.0","tasks": 
    [
        {
            "label": "build",//任务名,和lanuch.json中的"prelaunchTask":"build"一致
            "type": "shell","command": "g++","args":["-g","${workspaceRoot}/${fileBasenameNoExtension}.cpp","-o","${fileBasenameNoExtension}.out"],//要编译的文件mian_test.cpp,${workspaceRoot}表示vscode所打开的工作目录
            "problemmatcher":
            {
                "owner":"cpp","fileLocation":["relative","${workspaceRoot}"],"pattern":
                {
                    "regexp": "^([^\\\\s].*)\\\\((\\\\d+,\\\\d+)\\\\):\\\\s*(.*)$","file": 1,"line":2,"column":3,"severity": 4,"location": 2,"message": 5
                }
            }
        }
 
    ]
}

win10:

launch.json

{
    "version": "0.2.0","prelaunchTask": "build","program": "${fileDirname}/${fileBasenameNoExtension}.exe","miDebuggerPath": "C:/mingw/bin/gdb.exe",// 这里修改GDB路径为安装的mingw64的bin下的gdb.exe路径
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb","ignoreFailures": true
                }
            ]
        }]

tasks.json

{
    "version": "2.0.0","tasks": [
        {
            "label": "build","type": "shell","group": {
                "kind": "build","isDefault": true
            },"presentation": {
                "echo": true,"reveal": "always","focus": false,"panel": "shared"
            },"windows": {
                "command": "g++","args": [
                    "-ggdb","\"${file}\"","--std=c++11","-o","\"${fileDirname}\\${fileBasenameNoExtension}.exe\""
                ]
            }
        }
    ]
}

相关文章

Windows2012R2备用域控搭建 前置操作 域控主域控的主dns:自...
主域控角色迁移和夺取(转载) 转载自:http://yupeizhi.blo...
Windows2012R2 NTP时间同步 Windows2012R2里没有了internet时...
Windows注册表操作基础代码 Windows下对注册表进行操作使用的...
黑客常用WinAPI函数整理之前的博客写了很多关于Windows编程的...
一个简单的Windows Socket可复用框架说起网络编程,无非是建...