When build and run c++ program in VSCode on Window PC, all object files, executables, link files and debug files and generated in project root folder, which is very disorgnized. We can edit .vscode/task.json to make the compiled file to be saved in disired folders.

By the way, in order to use cl.exe (provided by visual studio) in vscode, vscode has to be launched from Visual Studio Developer Command Prompt.

The output files in working directory and the default task settings.

According to this, just modify /Fe, and add /Fd, /Fo arguments would do the trick.

The output files are all in "bin", and the edited task settings.