vscode C++配置
program:调试入口文件的地址
cwd:程序启动调试的目录
miDebuggerPath:调试器的路径
launch.json
// {
// // Use IntelliSense to learn about possible attributes.
// // Hover to view descriptions of existing attributes.
// // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
// "version": "0.2.0",
// "configurations": []
// }{// Use IntelliSense to learn about possible attributes.// Hover to view descriptions of existing attributes.// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387"version": "0.2.0","configurations": [{"name": "(gdb) Launch","type": "cppdbg","request": "launch",// "program": "${workspaceFolder}/a.out",// "program": "${workspaceFolder}.out",// "program": "${fileDirname}/${fileBasenameNoExtension}.out",//修改为.out// "program": "${fileDirname}\\output\\${fileBasenameNoExtension}.exe",// "program": "/home/kunsir/Documents/code/CProject/test/test/a.exe",// "program": "${workspaceRoot}/a.out", //${fileDirname}/${fileBasenameNoExtension}","program": "${workspaceRoot}/a.out","args": [],"stopAtEntry": false,"cwd": "${workspaceFolder}","environment": [],"externalConsole": true,"MIMode": "gdb","miDebuggerPath": "/usr/bin/gdb","preLaunchTask": "C/C++: g++ 生成活动文件","setupCommands": [{"description": "Enable pretty-printing for gdb","text": "-enable-pretty-printing","ignoreFailures": true}]}]
}
tasks.json
{"tasks": [{"type": "cppbuild","label": "C/C++: g++ 生成活动文件","command": "/usr/bin/g++","args": ["-fdiagnostics-color=always","-g","${file}","-o",// "${fileDirname}/${fileBasenameNoExtension}""${workspaceRoot}/a.out",],"options": {"cwd": "${fileDirname}"},"problemMatcher": ["$gcc"],"group": {"kind": "build","isDefault": true},"detail": "调试器生成的任务。"}],"version": "2.0.0"
}