.vscode\settings.json
配置python路径如下:{
"python.pythonPath": "D:\\APP\\Anaconda3\\envs\\py37\\python.exe"
}
.vscode\launch.json
配置python-debug如下:{
// 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": "Python: 当前文件",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
MinGW\\bin
C/C++: select a configuration...
—> 编辑配置json
,最终生成C/C++: Buid and Debug Activate file
—> gcc.exe 生成和调试文件
,最终生成tasks.json
的 “label”: “gcc123”{
"tasks": [
{
"type": "shell",
"label": "gcc123",
"command": "D:\\APP\\MinGW\\bin\\gcc.exe",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "D:\\APP\\MinGW\\bin"
},
"problemMatcher": [
"$gcc"
]
},
{
"type": "shell",
"label": "gcc.exe build active file",
"command": "D:\\APP\\MinGW\\bin\\gcc.exe",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "D:\\APP\\MinGW\\bin"
}
}
],
"version": "2.0.0"
}
(2)点击左侧的Debug按钮 —》点击设置(open launch.json)。。。添加–》c/c++ (gdb) 启动
如下
{
// 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) 启动",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/src/main.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "D:\\APP\\MinGW\\bin\\gdb.exe",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "gcc123"
},
{
"name": "Python: 当前文件",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
注意:
(1)"preLaunchTask": "gcc123"
和tasks.json
的 “label”: "gcc123"保持一致;
(2)“program”: "${workspaceFolder}/src/main.exe"路径修改为自己的
(3) “miDebuggerPath”: “D:\APP\MinGW\bin\gdb.exe”,路径修改为自己的
{
"python.pythonPath": "D:\\APP\\Anaconda3\\envs\\py37\\python.exe",
"code-runner.runInTerminal": true,
"code-runner.saveFileBeforeRun": true,
"code-runner.executorMap": {
"python": "D:\\APP\\Anaconda3\\envs\\py37\\python.exe -u"
}
}