c++ - VS Code:局部变量未正确显示
问题描述
抱歉,如果以前有人问过这个问题,但我没有得到以前给出的答案。我是 VS Code 的新手,并且知道一点 C++ 编码。我尝试了 windows/mingw 的教程: https ://code.visualstudio.com/docs/cpp/config-mingw#_step-through-the-code 并完成了所有工作。示例代码已经构建,我现在想调试,但是在调试时单步执行应用程序时,我的变量视图显示了一些不同的内容。(见附图) 这个词应该包含任何字符串,以及 msg 应该显示不同的东西。不过,我的自制手表显示正确。这是怎么回事?我按照教程做了所有事情。
另外:终端选项卡不会从 cout 输出味精,但我会在调试控制台中看到它。(参见“设置手表”一章上方教程中的图片)
启动.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": "g++.exe - Aktive Datei erstellen und debuggen",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Automatische Strukturierung und Einrückung für \"gdb\" aktivieren",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: g++.exe build active file"
}
]
}
抱歉,我是 vs 代码的新手:-/
解决方案
我使用 sourceforge 的 64 位版本的 MinGW 重新安装,因为我有一个通过 mingw-get 运行的旧 32 位版本。
推荐阅读
- arrays - 如何拥有一个作为数组的实例变量
- csv - 将ecto模式写入长生不老药中的csv文件?
- arrays - 以 O(n) 复杂度查找数组的所有连续子数组
- python - Fabric 使用 SSH 密钥连接 ec2 实例
- python - groupby python的百分比变化
- python - 在matplotlib中使用三角测量时如何处理在我的几何边缘之间形成的(不需要的)三角形
- java - 在eclipse IDE中找不到表错误,怎么办?
- ios - UIScrollView 的右锚点不适用
- java - 使用Java中的多线程以适当的顺序从两个文件中读取行
- reactjs - 将 Laravel Echo 与 React/Redux 应用程序集成