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

}

}

保存下。然后就可以了

相关推荐
数据饕餮1 天前
faster-whisper热词详解与程序设计
ide·macos·xcode
子枫秋月1 天前
单链表实现全解析
c语言·数据结构·c++
消失的旧时光-19431 天前
c语言 内存管理(malloc, calloc, free)
c语言·开发语言
歪歪1001 天前
在C#中除了按属性排序,集合可视化器还有哪些辅助筛选的方法?
开发语言·前端·ide·c#·visual studio
degen_1 天前
注册协议通知
c语言·笔记
Yupureki1 天前
从零开始的C++学习生活 19:C++复习课(5.4w字全解析)
c语言·数据结构·c++·学习·1024程序员节
许泽宇的技术分享1 天前
把 CLI 搬上 Web:在内网打造“可二开”的 AI IDE,为什么这条路更现实?
前端·ide·人工智能
2501_938791221 天前
VsCode 远程模式 + 服务器:Github Copilot 安装后无法触发?原因解析
服务器·vscode·github
NEU-UUN1 天前
C语言 . 第三章第二节 .递归函数
c语言·开发语言
奔跑吧邓邓子1 天前
【C语言实战(60)】打造校园信息管理系统(简易版),开启高效校园管理新篇章
c语言·开发实战·校园信息管理系统