- 1.VSCode的下载
- 2.配置C++环境
- 明确一些概念
官网链接
记得下载.deb格式的
点击运行-启动调试或者直接按F5会弹出launch.json的设置,之后会跳出task.json,要配置这两个文件,记得保存后就可以运行了。
明确一些概念单次运行一个脚本视为一个 task,相应的配置文件为 tasks.json,整个文件夹或者多个文件夹视为一个工作空间,配置文件为 settings.json,调试环境的配置文件叫 launch.json,这些配置文件是需要手动编辑的,编辑完保存好就会替代默认的配置文件生效。
launch.json配置
"version": "0.2.0",
"configurations": [
{
"name": "Python",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config:python.pythonPath}",
"program": "${file}",
"cwd": "${workspaceFolder}",
"env": {},
"envFile": "${workspaceFolder}/.env",
"console": "integratedTerminal"
},
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/${filebasenameNoExtension}.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "build",
"miDebuggerPath": "/usr/bin/gdb"
}
]
tasks.json配置
"tasks": [
{
"label": "python",
"type": "shell",
"command": "python",
"args": [
"${file}"
],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "shared"
}
},
{
"type": "shell",
"label": "build",
"command": "/usr/bin/g++",
"args": [
"-g", "${file}", "-std=c++11", "-o", "${filebasenameNoExtension}.out"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "调试器生成的任务。"
}
],
"version": "2.0.0"
setting.json配置
{
"editor.fontSize": 16,
"python.pythonPath": "/usr/bin/python2.7",
"python.formatting.provider": "yapf",
"files.insertFinalnewline": true
}



