试图让调试器在VS代码中工作:C Lang
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了试图让调试器在VS代码中工作:C Lang相关的知识,希望对你有一定的参考价值。
我已经配置了launch.json和tasks.json,然后返回到我的file.c,然后单击绿色箭头
我看到“附加的图像”。单击“确定”以允许访问,然后将调试器留给我,但不存在变量,并且诸如step_into,step_over之类的选项消失,然后我发现自己处于同一循环中
下面是启动和任务的JSON
感谢您花了几个小时,并且知道我需要学习调试,我之前使用过Chromes DevTools,但现在我正在学习C
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "clang - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"preLaunchTask": "clang build active file"
}
]
}
tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "msbuild",
"args": [
"/property:GenerateFullPaths=true",
"/t:build",
"/consoleloggerparameters:NoSummary"
],
"group": "build",
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
},
{
"type": "shell",
"label": "clang build active file",
"command": "/usr/bin/clang",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "/usr/bin"
},
"problemMatcher": [
"$gcc"
],
"group": "build"
}
]
}
发生故障的位置的附加图像
答案
是否存在断点,从图片中不清楚吗?我似乎代码未“暂停”,在代码运行时调试器将不会激活。
以上是关于试图让调试器在VS代码中工作:C Lang的主要内容,如果未能解决你的问题,请参考以下文章
C++ 代码在 VS2010 中工作,但在 2013 年不工作