Is there a way to set up Visual Studio Code with a debug task that compiles and debugs the current open .cpp file? I'm on macOS Sierra 10.12.6.
The standard documentation explains creating a task that compiles a specific .cpp file to a.out and modifying the launch.json to run that as a preLaunchTask, but then I have to create a new task for each .cpp file I create. It gets a bit tedious as I'm learning C++ and writing many small example programs.
Somebody asked a similar question here but this solution only seems to compile the first .cpp it encounters. If it compiled all .cpp files, it would probably help for me.