C++
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch (GDB)", // 配置名稱,將會在啓動配置的下拉菜單中顯示
"type": "cppdbg", // 配置類型,這裏只能爲cppdbg
"request": "launch", // 請求配置類型,可以爲launch(啓動)或attach(附加)
"targetArchitecture": "x86", // 生成目標架構,一般爲x86或x64,可以爲x86, arm, arm64, mips, x64, amd64, x86_64
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe", // 將要進行調試的程序的路徑
"miDebuggerPath": "I:\\Program Files\\mingw-w64\\x86_64-5.3.0-posix-seh-rt_v4-rev0\\mingw64\\bin\\gdb.exe", // miDebugger的路徑,注意這裏要與MinGw的路徑對應
"args": [], // 程序調試時傳遞給程序的命令行參數,一般設爲空即可
"stopAtEntry": false, // 設爲true時程序將暫停在程序入口處,一般設置爲false
"cwd": "${workspaceRoot}", // 調試程序時的工作目錄,一般爲${workspaceRoot}即代碼所在目錄
"externalConsole": true, // 調試時是否顯示控制檯窗口,一般設置爲true顯示控制檯
"preLaunchTask": "build" // 調試會話開始前執行的任務,一般爲編譯程序
}
]
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "build", // 任務名,要和launch.json中preLaunchTask字段一致;
"command": "g++",
"args": [
"-g", "${file}", "-o", "${fileDirname}\\${fileBasenameNoExtension}.exe"
]
}
],
}
Python
launch.json
{
// 使用 IntelliSense 瞭解相關屬性。
// 懸停以查看現有屬性的描述。
// 欲瞭解更多信息,請訪問: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python",
"type": "python",
"request": "launch",
"stopOnEntry": false,//是否在第一條語句時程序停止,下面的這個選項都一樣
"pythonPath": "/usr/bin/python3",//可執行文件路徑
"program": "${file}",
"cwd": "${workspaceRoot}",
// "env": {},
// "envFile": "${workspaceRoot}/.env",
},
]
}