-1

Unable to start debug C++ in VSCode due to a program path is missing or invalid error

My launch.json configuration:

"version": "0.2.0",
    "configurations": [
        {
            "name": "C++ Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/learn.cpp",
            "args": ["arg1", "arg2"],
            "environment": [{ "name": "config", "value": "Debug" }],
            "cwd": "${workspaceFolder}"
        }
    ]
}
gavrilikhin.d
  • 554
  • 1
  • 7
  • 20
  • 1
    VSCode is not very beginner friendly. I'd recommend an IDE like Visual Studio Community Edition or Qtcreator instead. – Jesper Juhl Aug 12 '23 at 10:57
  • 2
    This is wrong `"program": "${workspaceFolder}/learn.cpp"`. Your program should be a `.exe` not a `.cpp` file. Look in `tasks.json` to see what it is called. – john Aug 12 '23 at 11:26
  • Yes, `"args"` is where you put your arguments for `main`. – john Aug 12 '23 at 11:26

0 Answers0