Open Vscode: Open Command Pallete : ctrl+shift+p Run > Tasks: Configure Default Build Task
change GCC to G++ COMPILER
Open task.json file in your program folder and Ensure that the "command" field is using g++
like: "command": "g++",