in tasks.json:
"label": "g++.exe build active file",
"args": [
"-g",
"${fileDirname}\\**.cpp",
//"${fileDirname}\\**.h",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe",
],
in launch.json:
"preLaunchTask": "g++.exe build active file"
it will work if your sources are in separated folder