launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch", // 配置名稱,將會在啓動配置的下拉菜單中顯示
"type": "cppdbg", // 配置類型,這裏只能爲cppdbg
"request": "launch", // 請求配置類型,可以爲launch(啓動)或attach(附加)
"program": "${workspaceRoot}/${fileBasenameNoExtension}.exe",// 將要進行調試的程序的路徑
"args": [], // 程序調試時傳遞給程序的命令行參數,一般設爲空即可
"stopAtEntry": false, // 設爲true時程序將暫停在程序入口處,一般設置爲false
"cwd": "${workspaceRoot}", // 調試程序時的工作目錄,一般爲${workspaceRoot}即代碼所在目錄
"environment": [],
"externalConsole": true, // 調試時是否顯示控制檯窗口,一般設置爲true顯示控制檯
"MIMode": "gdb",
"miDebuggerPath": "C:\\MinGW\\bin\\gdb32.exe", // miDebugger的路徑,注意這裏要與MinGw的路徑對應
"preLaunchTask": "gcc", // 調試會話開始前執行的任務,一般爲編譯程序,c++爲g++, c爲gcc
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
task.json
{
"version": "2.0.0",
"command": "gcc",
"args": ["-g","${file}","-o","${fileBasenameNoExtension}.exe"], // 編譯命令參數
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
c_cpp_properties.json
{
"configurations": [{
"name": "MinGW",
"intelliSenseMode": "gcc-x64",
"compilerPath": "D:/App/MinGW/mingw64/bin/x86_64-w64-mingw32-gcc.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"includePath": [
// 下面路徑中的 D:/App/MinGw 部分需要替換成你的 MinGw-w64 安裝路徑
"${workspaceFolder}/**",
"C:/MinGW/mingw64/x86_64-w64-mingw32/include",
"C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/7.3.0/include/c++",
"C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/7.3.0/include/c++/tr1"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE",
"__GNUC__=7",
"__cdecl=__attribute__((__cdecl__))"
],
"browse": {
"path": [
// 下面路徑中的 D:/App/MinGw 部分需要替換成你的 MinGw-w64 安裝路徑
"${workspaceFolder}/**",
"C:/MinGW/mingw64/x86_64-w64-mingw32/include",
"C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/7.3.0/include/c++",
"C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/7.3.0/include/c++/tr1"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}],
"version": 4
}