0

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
        }
      ]
    }
  ]
}
3
  • the build is not done by the launch config but by a task, use variables in your launch config instead of hard coded paths Commented Nov 14, 2021 at 19:40
  • @rioV8 can you explain more pls ? Commented Nov 14, 2021 at 20:00
  • read the VSC doc pages about debugging Commented Nov 14, 2021 at 20:11

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.