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": "调试器生成的任务。"
        }
    ]
}
相关推荐
lyj1689973 小时前
vue-i18n+vscode+vue 多语言使用
前端·vue.js·vscode
葬歌倾城5 小时前
JSON的缩进格式方式和紧凑格式方式
c#·json
这是个栗子6 小时前
【问题解决】VSCode终端中看不到Git-Bash
ide·git·vscode
岁月玲珑9 小时前
【使用Android Studio调试手机app时候手机老掉线问题】
android·ide·android studio
木头没有瓜14 小时前
vscode离线安装插件
ide·vue.js·vscode
lls23315 小时前
恢复idea文件目录
ide
NeRF_er17 小时前
使用 VScode Debug加不上断点的原因
ide·vscode·编辑器
GHL28427109017 小时前
error MSB8041: 此项目需要 MFC 库。从 Visual Studio 安装程序(单个组件选项卡)为正在使用的任何工具集和体系结构安装它们。
ide·visual studio
火车叨位去194918 小时前
Java中的JSON序列化和反序列化
json
专注VB编程开发20年21 小时前
javascript的类,ES6模块写法在VSCODE中智能提示
开发语言·javascript·vscode