How to use -fsanitize=undefined (GNU debugging flag) with GCC compiler?

i m using GCC compiler which i downloaded from here - https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe/download
I have a windows 10 machine and am using VS Code’s integrated cmd terminal to compile my main.cpp files. (below is a screenshot attached of my IDE)

My Problem
when i tried to compile my main.cpp file with this GNU flag -fsanitize=undefined
using the below given command :
C:\Users\Humble Fool\Desktop\dummy>g++ main.cpp -g -D_GLIBCXX_DEBUG -fsanitize=undefined -ftrapv

I got this error -

C:/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lubsan        
collect2.exe: error: ld returned 1 exit status

but when i used this command :
C:\Users\Humble Fool\Desktop\dummy>g++ main.cpp -g -D_GLIBCXX_DEBUG -ftrapv
the .cpp file compiled properly !

So i figured out that problem is with -fsanitize=undefined flag.
How Can I fix it ?

Few people on stackoverflow were saying that maybe my compiler doesn’t supports it ! but I have seen a screenshot using g++ compiler (not on windows, probably Linux) and this flag worked with no issue !