系统方面配置自行查找
linux:
launch.json
{ // 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。 // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0","configurations": [ { "name": "(gdb) Launch","type": "cppdbg","request": "launch","program": "${workspaceRoot}/${fileBasenameNoExtension}.out","args": [],"stopAtEntry": false,"cwd": "${workspaceFolder}","environment": [],"externalConsole": true,"MIMode": "gdb","setupCommands": [ { "description": "Enable pretty-printing for gdb","text": "-enable-pretty-printing","ignoreFailures": true } ],"prelaunchTask": "build" } ] }
tasks.json
{ "version": "2.0.0","tasks": [ { "label": "build",//任务名,和lanuch.json中的"prelaunchTask":"build"一致 "type": "shell","command": "g++","args":["-g","${workspaceRoot}/${fileBasenameNoExtension}.cpp","-o","${fileBasenameNoExtension}.out"],//要编译的文件mian_test.cpp,${workspaceRoot}表示vscode所打开的工作目录 "problemmatcher": { "owner":"cpp","fileLocation":["relative","${workspaceRoot}"],"pattern": { "regexp": "^([^\\\\s].*)\\\\((\\\\d+,\\\\d+)\\\\):\\\\s*(.*)$","file": 1,"line":2,"column":3,"severity": 4,"location": 2,"message": 5 } } } ] }
win10:
launch.json
{ "version": "0.2.0","prelaunchTask": "build","program": "${fileDirname}/${fileBasenameNoExtension}.exe","miDebuggerPath": "C:/mingw/bin/gdb.exe",// 这里修改GDB路径为安装的mingw64的bin下的gdb.exe路径 "setupCommands": [ { "description": "Enable pretty-printing for gdb","ignoreFailures": true } ] }]
tasks.json
{ "version": "2.0.0","tasks": [ { "label": "build","type": "shell","group": { "kind": "build","isDefault": true },"presentation": { "echo": true,"reveal": "always","focus": false,"panel": "shared" },"windows": { "command": "g++","args": [ "-ggdb","\"${file}\"","--std=c++11","-o","\"${fileDirname}\\${fileBasenameNoExtension}.exe\"" ] } } ] }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。