vscode 配置 c++ 调试

it2022-05-05  137

launch.json

{ // 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。 // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "gdb", "type": "cppdbg", "request": "launch", "program": "${fileDirname}\\${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, //若是false则不能输入 "MIMode": "gdb", "miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ], "preLaunchTask": "Build" } ] }

tasks.json

{ "version": "2.0.0", "tasks": [ { "label": "Build", "command": "g++", "args": [ "-g", "-Wall", "-std=c++11", "-lm", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}.exe" ], "presentation": { "reveal": "always", "echo": false, "focus": true }, "problemMatcher": { "owner": "cpp", "fileLocation": "absolute", "pattern": { "regexp": "^(.*):(\\d+):(\\d+):\\s+(error):\\s+(.*)$", "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5 } } }, { "label": "Run", "type": "shell", "dependsOn": "Build", "command": "${fileDirname}/${fileBasenameNoExtension}.exe", "args": [], "presentation": { "reveal": "always", "focus": true }, "problemMatcher": [], "group": { "kind": "test", "isDefault": true } } ] }

最新回复(0)