vscode配置C语言打断点

搞了半天,也不知道为什么,不能打断点,后来就可以了。

1,VSCODE启动要管理员启动。

launch.json文件内容

{

"version": "0.2.0",

"configurations": [

{

"name": "(Windows) Launch",

"type": "cppvsdbg",

"request": "launch",

"program": "cmd",

"preLaunchTask": "echo",

"args": [

"/C",

"{fileDirname}\\\\{fileBasenameNoExtension}.exe",

"&",

"echo.",

"&",

"pause"

],

"stopAtEntry": false,

"cwd": "${workspaceFolder}",

"environment": [],

"externalConsole": true

},

{

"name": "(gdb) Launch",

"type": "cppdbg",

"request": "launch",

"program": "{workspaceFolder}/{fileBasenameNoExtension}.exe",

"args": [],

"stopAtEntry": false,

"cwd": "${workspaceFolder}",

"environment": [],

"externalConsole": true,

"MIMode": "gdb",

"miDebuggerPath": "C:\\mingw64\\bin\\gdb.exe", // 自己电脑的gdb

"preLaunchTask": "echo", //这里和task.json的label相对应

"setupCommands": [

{

"description": "Enable pretty-printing for gdb",

"text": "-enable-pretty-printing",

"ignoreFailures": true

}

]

}

]

}

tasks.json内容

{

// See https://go.microsoft.com/fwlink/?LinkId=733558

// for the documentation about the tasks.json format

"version": "2.0.0",

"tasks": [

{

"label": "echo",

"type": "shell",

"command": "gcc",

"args": [

"-g",

"${file}",

"-o",

"${fileBasenameNoExtension}.exe",

"-fexec-charset=GBK" //解决中文乱码

]

}

],

"presentation": {

"echo": true,

"reveal": "always",

"focus": false,

"panel": "shared",

"showReuseMessage": true,

"clear": false

}

}

保存下。然后就可以了

相关推荐
凯子坚持 c18 分钟前
C语言复习概要(三)
c语言·开发语言
无限大.30 分钟前
c语言200例 067
java·c语言·开发语言
无限大.32 分钟前
c语言实例
c语言·数据结构·算法
Death20035 分钟前
Qt 中的 QListWidget、QTreeWidget 和 QTableWidget:简化的数据展示控件
c语言·开发语言·c++·qt·c#
惜.己37 分钟前
javaScript基础(8个案例+代码+效果图)
开发语言·前端·javascript·vscode·css3·html5
Death2001 小时前
Qt 3D、QtQuick、QtQuick 3D 和 QML 的关系
c语言·c++·qt·3d·c#
洛临_1 小时前
【C语言】基础篇
c语言·算法
长天一色2 小时前
C语言日志类库 zlog 使用指南(第五章 配置文件)
c语言·开发语言
whltaoin3 小时前
【408计算机考研课程】-C语言认知
c语言·考研
一般清意味……3 小时前
快速上手C语言【上】(非常详细!!!)
c语言·开发语言