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

}

}

保存下。然后就可以了

相关推荐
罗政6 小时前
冒险岛079 V8 整合版源码搭建教程+IDEA启动
java·ide·intellij-idea
艾斯比的日常8 小时前
VSCode 实用快捷键
ide·vscode·编辑器
Galaxy_12298 小时前
vscode远程报错:Remote host key has changed,...
ide·vscode·编辑器
彬sir哥8 小时前
VScode运行后出现黑窗口
vscode·运行·黑窗口
YH_DevJourney8 小时前
Linux-C/C++《C/7、字符串处理》(字符串输入/输出、C 库中提供的字符串处理函数、正则表达式等)
linux·c语言·c++
就爱学编程8 小时前
C语言预编译
c语言·开发语言
和光同尘@8 小时前
1011. A+B和C (15)-PAT乙级真题
c语言·开发语言·数据结构·c++·算法
小呀小萝卜儿10 小时前
2025-02-18 学习记录--C/C++-PTA 7-24 约分最简分式
c语言·学习
enyp8012 小时前
Qt QDateTimeEdit总结
c语言·开发语言
Hi~晴天大圣13 小时前
Pycharm中断点使用技巧
ide·python·pycharm