if above method is not working then try this, "e/CP" => this is my directory path in windows (E:\CP)
{
"shell_cmd": "wsl g++ /mnt/e/CP/${file_base_name}.cpp && wsl ./a.out",
"selector": "source.c++, source.cpp",
"file_regex": "^(.*):(\\d+):(\\d+): error: (.*)$"
}