Unable to start debugging. Unexpected GDB output from the command -environment-cd "Path" . No such file or directory

Viewed 3425

I've just started to use VSCode, I meet this error and try some ways to fix but it doesn't work.

This is my 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"
    }
]

} enter image description here

2 Answers

Problem fixed by doing these steps below.

Go to Windows Control Panel (You can do this by opening File Explorer and in the path type 'Control Panel' (without quotes) and hit Enter);

  1. From the Control Panel, click on 'Clock and Region'.

  2. Click Region. A new screen will open.

  3. In the screen that opened, click on Administrative and search for the button "Change system location".

  4. Check the option: "Beta: Use Unicode UTF-8 for world language support"

  5. Restart the computer.

Posted on behalf of the question asker

the problem was with Launch.json

the path files should not have any spaces like in my case "prog files" was error and i replaced and rename folder with "progfiles"

"program": "D:\\Progfiles\\vscode\\hello.exe",
"args": [],
"stopAtEntry": false,
"cwd": "D:\\Progfiles\\vscode",
"environment": [],
Related