xxxxxxxxxx
hover on the line showing error
left click on the bulb, it will take you to C/C++ configurations
Now change complier path to C:/MinGW64/bin/g++.exe
on the top u will see a link c_cpp_properties.json click on it
in c_cpp_properties.json "intelliSenseMode": "windows-gcc-x64"
This works well.
source: https://github.com/microsoft/vscode-cpptools/issues/5723