首页 > 解决方案 > 无法开始调试。命令 -environment-cd "Path" 的意外 GDB 输出。没有这样的文件或目录

问题描述

我刚开始使用VSCode,我遇到了这个错误并尝试了一些方法来修复,但它不起作用。

这是我的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": "C/C++: Build and debug active file",
        "type": "cppdbg",
        "request": "launch",
        "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": true,
        "MIMode": "gdb",
        "miDebuggerPath": "C:\\TDM-GCC-64\\gdb64\\bin\\gdb.exe",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ],
        "preLaunchTask": "C/C++: g++.exe build active file"
    }
]

} 在此处输入图像描述

标签: c++visual-studio-codecompiler-errors

解决方案


通过执行以下这些步骤解决了问题。

转到 Windows 控制面板(您可以通过打开文件资源管理器并在路径中输入“控制面板”(不带引号)并按 Enter 来执行此操作);

  1. 在控制面板中,单击“时钟和区域”。

  2. 单击区域。将打开一个新屏幕。

  3. 在打开的屏幕中,单击“管理”并搜索“更改系统位置”按钮。

  4. 检查选项:“测试版:使用 Unicode UTF-8 支持世界语言”

  5. 重新启动计算机。

代表提问者发布


推荐阅读