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

}

}

保存下。然后就可以了

相关推荐
1024奇点3 分钟前
【仓颉语言入门 · 第二篇 第 8 课】
开发语言·数据库·ide·mysql·开源
xiaoye-duck36 分钟前
《C++ 项目:手写大模型接入 SDK》Trae IDE 开发环境搭建与依赖管理
c++·ide·语言模型
H.莓飛41 分钟前
【Linux】自主 Shell
linux·运维·服务器·c语言·开发语言·visual studio
爱读书的小胖1 小时前
Codewars:Last digit of a large number(C)解题分析
c语言·开发语言·r语言
想做小南娘,发现自己是女生喵2 小时前
第二周学习文档 Linux C 文件操作
linux·c语言·学习
一只笨菜鸟2 小时前
IDEA如何让多个项目同时显示
java·ide·intellij-idea
Bluetooth7302 小时前
c语言变量的存储类别
c语言
lhbweilai8 小时前
分析FreeRTOS内核对象API的源码实现(四)
c语言·stm32·单片机
inrichtt11 小时前
第八课时:SPI总线揭秘:四线全双工通信的奥
c语言·数据结构·stm32·单片机·嵌入式硬件
wuminyu14 小时前
JMM学习总结:深入理解happens-before关系
java·linux·c语言·jvm·c++