VScode中launch和task參數解釋

一、launch.json

{
    // 使用 IntelliSense 瞭解相關屬性。 
    // 懸停以查看現有屬性的描述。
    // 欲瞭解更多信息,請訪問: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "g++.exe - 生成和調試活動文件",
            "type": "cppdbg",                       // 只能是cppdbg
            "request": "launch",                    // launch:啓動,attach:附加
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",    // 需要調試的程序
            "args": [],                             // 調試時傳遞給程序的參數
            "stopAtEntry": false,                   // 調試時是否停在程序入口:{true:是,false:否}
            "cwd": "${workspaceFolder}",            // 工作目錄
            "environment": [],                      // 額外的環境變量
            "externalConsole": true,                // true:輸出到外部終端;false:只輸出到軟件終端(有顯示不全的可能)
            "MIMode": "gdb",
            "miDebuggerPath": "D:\\codeblocks-16.01mingw-nosetup\\MinGW\\bin\\gdb.exe", // 調試gdb路徑
            "setupCommands": [                      // 暫時不知道作用
                {
                    "description": "爲 gdb 啓用整齊打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++.exe build active file" // 預編譯任務名稱,和tasks.json中的label必須相同
        }
    ]
}

二、task.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        //task1
        {
            "label": "C/C++: g++.exe build active file",        // 任務名稱,和launch.json中的preLaunchTask必須相同
            "type": "shell",
            "command": "g++",                                   // 終端命令
            "args": [                                           // 終端命令附加參數
                "${file}",
                ".\\Point\\point.cpp",
                ".\\Point\\point.h",
                "test.cpp",
                "test.h",                                       // 以上是需要編譯的源文件和頭文件
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe",// 編譯後的文件名稱,和launch.json中的program必須相同
                "-g",
                "-Wall"
            ],
            "presentation": {                                   // 未知作用
                "echo": true,
                "reveal": "always",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": true,
                "clear": false
            }
        }
    ]
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章