The version which MSYS2 is default for gcc-toolchain v15.2.0 is have issues in compiling due to dynamic Libraries linking issue. MSYS2 should also provide option to switch to more stable version of gcc such as 13.2.0
because to compile with gcc-toolchain
v15.2.0
need to use -static linking in args
g++ -static {file} -o {output}