Visual Studio Code: launch.json

c_cpp_properties.json

cpp 复制代码
{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "D:/Kingsoft/mingw64/include/**",
                "D:/Kingsoft/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++",
                "D:/Kingsoft/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32",
                "D:/Kingsoft/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward",
                "D:/Kingsoft/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include",
                "D:/Kingsoft/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed",
                "D:/Kingsoft/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/include"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "__GNUC__=6",
                "__cdecl=__attribute__((__cdecl__))"
            ],
            "compilerPath": "D:/Kingsoft/mingw64/bin/gcc.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-x64"
        }
    ],
    "version": 4
}

launch.json

cpp 复制代码
// {
//     "version": "0.2.0",
//     "configurations": [
//         {
//             "name": "(Windows) Launch",
//             "type": "cppvsdbg",
//             "request": "launch",
//             "program": "cmd",
//             "preLaunchTask": "echo",
//             "args": [
//                 "/C",
//                 "${fileDirname}\\${fileBasenameNoExtension}.exe",
//                 "&",
//                 "echo.",
//                 "&",
//                 "pause"
//             ],
//             "stopAtEntry": false,
//             "cwd": "${workspaceFolder}",
//             "environment": [],
//             "console":"newExternalWindow"
//         },
//         {
//             "name": "(gdb) Launch",
//             "type": "cppdbg",
//             "request": "launch",
//             "targetArchitecture": "x64",
//             // "program": "C:/code/ccode1/exe/${fileBasenameNoExtension}.exe",
//             "program": "${workspaceFolder}/${fileBasenameNoExtension}.exe",
            
//             "miDebuggerPath": "D:\\Kingsoft\\mingw64\\bin\\gdb.exe",
//             "args": [],
//             "stopAtEntry": false,
//             // "cwd": "${fileDirname}",
//             // "cwd": "C:/code/ccode1/exe/",
//             "cwd": "${workspaceFolder}",
 
//             "externalConsole": true,
//             "preLaunchTask": "g++"
//         }
//     ]
// }


{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "targetArchitecture": "x64",
            "program": "${workspaceFolder}/${fileBasenameNoExtension}.exe",
            
            "miDebuggerPath": "D:\\Kingsoft\\mingw64\\bin\\gdb.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",

            "externalConsole": true,
            "preLaunchTask": "g++"
        }
    ]
}

tasks.json

cpp 复制代码
{
    "version": "2.0.0",
    "command": "g++",
    "type": "shell",
    "presentation": {
        "echo": true,
        "reveal": "always",
        "focus": false,
        "panel": "new",//shared表示共享,改成new后每个进程创建新的端口,"panel"->"new"
        "showReuseMessage": true,
        "clear": false
    },
    "args": [
        // "-m32",
        "-fdiagnostics-color=always",
        "-g",
        "${file}",
        "-o",
        // "${fileDirname}/${fileBasenameNoExtension}.exe"
        "${workspaceFolder}/${fileBasenameNoExtension}.exe"
        // "C:/code/ccode1/exe/${fileBasenameNoExtension}.exe"

        //"-fexec-charset=GBK"
    ],//编译命令参数
    "problemMatcher": {
        "owner": "cpp",
        "fileLocation": [
            "relative",
            "${workspaceRoot}"
        ],
        "pattern": {
            "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
            "file": 1,
            "line": 2,
            "column": 3,
            "severity": 4,
            "message": 5
        }
    },
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: gcc.exe 生成活动文件",
            "command": "D:\\Kingsoft\\mingw64\\bin\\gcc.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
               "${fileDirname}\\${fileBasenameNoExtension}.exe"
                // "C:/code/ccode1/exe/${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "D:/Kingsoft/mingw64/bin"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "调试器生成的任务。"
        }
    ]
}
相关推荐
Json_1817901448010 小时前
An In-depth Look into the 1688 Product Details Data API Interface
大数据·json
哟哟耶耶12 小时前
js-将JavaScript对象或值转换为JSON字符串 JSON.stringify(this.SelectDataListCourse)
前端·javascript·json
小灰灰__13 小时前
IDEA加载通义灵码插件及使用指南
java·ide·intellij-idea
Mortal_hhh14 小时前
VScode的C/C++点击转到定义,不是跳转定义而是跳转声明怎么办?(内附详细做法)
ide·vscode·stm32·编辑器
无极程序员14 小时前
PHP常量
android·ide·android studio
努力的家伙是不讨厌的15 小时前
解析json导出csv或者直接入库
开发语言·python·json
小黄人软件17 小时前
android浏览器源码 可输入地址或关键词搜索 android studio 2024 可开发可改地址
android·ide·android studio
Mephisto.java20 小时前
【大数据学习 | kafka高级部分】kafka的优化参数整理
大数据·sql·oracle·kafka·json·database
沐雪架构师21 小时前
mybatis连接PGSQL中对于json和jsonb的处理
json·mybatis