Steve Frazee
Steve Frazee

Reputation: 213

VSCode not creating launch.json file

I'm debugging a project in VSCode using msvc. When I run the debugger, VSCode asks me to choose an environment and I choose the "C++ (Windows)" option:

choose_environment

Then it asks me to select a configuration:

enter image description here

I choose the "cl.exe build and debug active file". Everything runs correctly and it creates the ".vscode" folder with the "tasks.json" file in there for the next time I try and build the project. It DOES NOT create the "launch.json" so every time I want to run the debugger I have to select the configuration again. In previous projects, the "launch.json" was created with the correct configuration here:

enter image description here

Why is vscode not creating the "launch.json" file? Am I missing something?

Upvotes: 12

Views: 10878

Answers (1)

Vitor Mouro
Vitor Mouro

Reputation: 53

According to the VSCode documentation on C/C++:

When you debug with the play button or F5, the C++ extension creates a dynamic debug configuration on the fly.

There are cases where you'd want to customize your debug configuration, such as specifying arguments to pass to the program at runtime. You can define custom debug configurations in a launch.json file.

To create launch.json, choose Add Debug Configuration from the play button drop-down menu.

Example

Source: Configure VS Code for Microsoft C++

Upvotes: 2

Related Questions