使用makefile文件编译程序需要的Vscode 配置文件
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": [
{
"name": "g++ - 生成和调试活动文件",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"internalConsoleOptions": "neverOpen",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "g++ build active file",
"miDebuggerPath": "/usr/bin/gdb"
}
]
} task.json
{
"tasks": [
{
"type": "shell",
"label": "g++ build active file",
"command": "make",
"args": [],
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "shell",
"label": "g++ build active file",
"command": "make",
"args": ["clean_o"],
"problemMatcher": [],
}
],
"version": "2.0.0"
}
/*
//若使用g++代码如下
"command:"g++"
"args": [
/*"-g",
"${fileDirname}/*.cpp",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
]
"options": {//[使用make命令必须删除该段代码]
"cwd": "/usr/bin"
},
[Tips:使用g++编译器时使用这段代码]
*/


