Linking C shared library

I was trying to build GMT (generic mapping tool) following this installation guide : gmt/BUILDING.md at master · GenericMappingTools/gmt · GitHub where using the command:
“cmake --build . --config Release” starts to build objective files and it FAILED for one command
gives this error
“Linking C shared library src\gmt.dll
FAILED: src/gmt.dll src/gmt.dll.a”
gmt.dll file is present in src directory.

and at the end it says

"C:/msys64/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/13.2.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/gmtlib.dir/gmt_init.c.obj:gmt_init.c:(.text+0x464c0): undefined reference to `__imp__set_fmode’
collect2.exe: error: ld returned 1 exit status
"
I am using minGW UCRT64 to build GMT, Please if anyone can help me regarding this i am trying to build this for almost a month now

It looks like something from the standard library. According to this issue, MinGW is not providing them as actual functions properly.

Hi Ben, how can I fix this issue, I mean its solution is not mentioned in the link you have provided as well.

It looks like an existing issue that hasn’t been fixed. Might there be another function provided?