0

New to this stuff and vscode wont let me debug my C++ file. Whenever i hit F5, i get the following error:

Unable to start debugging. Unexpected GDB output from command "-environment-cd"d:\Users\MyName\\OneDrive\\Documentos\\My Projects"". d:\Users\MyName\OneDrive\Documentos\My Projects: No such file or directory

This is my launch.json file. Ive already tried this solution with no results.

{
    // 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 - Compilar y depurar el archivo activo",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": true,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\Strawberry\\c\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Habilitar la impresión con sangría para gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++.exe compilar archivo activo"
        }
    ]

}
2
  • My advice is to never use a space in a path where you put your c or c++ code. The reason is most compilers use the command line and a space character on the command line separates arguments. To get around the issue the path needs to be quoted. Commented Nov 7, 2021 at 14:12
  • Another poster on SO said that they had trouble with accents on file names. Maybe your accents in impresión and sangría are causing problems. Commented Oct 21, 2022 at 20:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.