In your initial post you referred to tdm-gcc. I don’t profess to have any expertise in this area, but that’s a different compiler than what I referenced in:
https://discourse.gohugo.io/t/gcc-compiler-required-to-build-hugo-from-source-on-windows/41370
And I know that works.