VS Code:局部变量未正确显示 [英] VS Code: local variables not showing correctly

查看:64
本文介绍了VS Code:局部变量未正确显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

抱歉,如果之前有人问过这个问题,但我没有得到之前给出的答案.我是 VS Code 的新手并且知道一些 C++ 编码.我尝试了 windows/mingw 的教程:这个词应该包含任何字符串,并且 msg 应该显示不同的东西.不过,我的自制手表 i int 显示正确.这是怎么回事?我按照教程做了所有的事情.

Sorry if this has been asked before, but I don't get the previous given answers. I'm new to VS Code and know a bit of c++ coding. I tried the tutorial for windows/mingw : https://code.visualstudio.com/docs/cpp/config-mingw#_step-through-the-code and done everything so far. The sample code has been build and I want to debug now, but my variables view is showing something different when stepping through the application when debugging. (see attached image) The word should contain any of the strings, as well as msg should show something different. My watch for a self made i int shows correctly, though. Whats'up? I did everything as in the tutorial.

还有:终端选项卡不会从 cout 输出 msg,但我在调试控制台中看到它.(请参阅设置手表"一章上方教程中的图片)

also: the terminal tab does not output the msg from cout, but I see it in the debug console instead. (see image in tutorial just above the chapter 'set a watch')

launch.json 是:

launch.json is:

{
    // 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 代码的新手:-/

sorry, i'm a newb to vs code :-/

推荐答案

我使用 sourceforge 的 64 位版本的 MinGW 重新安装,因为我有一个通过 mingw-get 运行的旧 32 位版本.

I re-installed using the 64bit version of MinGW from sourceforge as I had an old 32 bit version running via mingw-get.

这篇关于VS Code:局部变量未正确显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆