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

}

}

保存下。然后就可以了

相关推荐
知识领航员4 小时前
蘑兔AI音乐深度实测:功能拆解、实测表现与适用场景
java·c语言·c++·人工智能·python·算法·github
程序leo源9 小时前
C语言知识总结
c语言·开发语言·c++·经验分享·笔记·青少年编程·c#
爱编码的小八嘎9 小时前
C语言完美演绎9-30
c语言
爱编码的小八嘎10 小时前
C语言完美演绎9-28
c语言
freewlt10 小时前
Cline v3.82.0 发布:VS Code AI编程助手迎来重大更新
vscode·cline
笨笨饿11 小时前
80_聊聊SPI以及它们的变体
linux·c语言·网络·stm32·单片机·算法·个人开发
坚果派·白晓明11 小时前
【鸿蒙PC三方库移植适配框架解读系列】第四篇:构建执行、产物获取与 HAP 集成
c语言·华为·harmonyos·鸿蒙·c/c++三方库
Cinema KI11 小时前
Linux C/C++ 编译构建:GCC/G++ + Makefile 零基础完整教程
linux·c语言·c++
念恒1230611 小时前
基础IO(文件缓冲区)
linux·c语言·c++
HealthScience12 小时前
vscode使用Excel插件导致codex插件无法粘贴图片
服务器·vscode·excel