Moami
Moami

Reputation: 9

vscode launch.json configuration

I have an issue with launch a cpp project file with vscode, here is my error launch program {workspace domain}\build\Debug\outDebug does not exist. and that's true, but i want to know can I add a parameter to my launch.json file or edit it, to work like : if a there is no directory to put the build file into it, so make it! is it possible to do that ?

here is my launch.json file source

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "C/C++ Runner: Debug Session",
      "type": "cppdbg",
      "request": "launch",
      "args": [],
      "stopAtEntry": false,
      "cwd": "o:\\Developing\\Projects\\Training\\c++\\School",
      "environment": [],
      "program": "o:\\Developing\\Projects\\Training\\c++\\School\\build\\Debug\\outDebug",
      "internalConsoleOptions": "openOnSessionStart",
      "MIMode": "gdb",
      "miDebuggerPath": "gdb",
      "externalConsole": false,
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ]
    }
  ]
}

Upvotes: 0

Views: 10640

Answers (1)

user12495487
user12495487

Reputation: 11

There is no need to add a parameter to the launch.json file or edit it because the C/C++ Runner extension (which creates the "C/C++ Runner: Debug Session" configuration) creates the necessary folders/files when it is used to build the cpp file. You will need to add a configuration to the launch.json file if you do not use C/C++ Runner to build the project because "C/C++ Runner: Debug Session" will then fail (relevant folders/files do not exist). This is a very belated response but it may help others with the same query.

Documentation for building project using C/C++ Runner: https://marketplace.visualstudio.com/items?itemName=franneck94.c-cpp-runner

Upvotes: 0

Related Questions