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

}

}

保存下。然后就可以了

相关推荐
努力的ping3 小时前
vcpkg在vs/vscode下用法
ide·vscode·编辑器
mftang6 小时前
配置 VSCode + Keil 开发环境
ide·vscode
玖剹7 小时前
Linux文件操作:从C接口到系统调用
linux·服务器·c语言·c++·笔记·ubuntu
屁股割了还要学9 小时前
【数据结构入门】链表
c语言·开发语言·数据结构·c++·学习·算法·链表
培林将军11 小时前
Visual Studio Code的下载,安装
ide·vscode·编辑器
界面开发小八哥12 小时前
「Java EE开发指南」如何用MyEclipse创建企业应用项目?(二)
java·ide·java-ee·开发工具·myeclipse
skywalk816312 小时前
Ubuntu24.04的VSCode中安装MoonBit和MoonBit Toolchain(moon-pilot)
ide·人工智能·vscode·编辑器·moonbit·pilot
焊锡与代码齐飞13 小时前
嵌入式第十八课!!数据结构篇入门及单向链表
c语言·数据结构·学习·算法·链表·排序算法
蜀山雪松13 小时前
Windows中Idea或者其他开发工具如何使用Google Sans Code - 码农开源等宽字体
java·ide·intellij-idea
亿维数组13 小时前
【CSAPP全书详细笔记系列】第一章-计算机系统概述
c语言·笔记·计算机系统