背景
编译go项目报错
cgo: C compiler "gcc" not found: exec: "gcc": executable file not found in %PATH%
错误由于在windows下无GCC编译器导致的,可以下载一个MinGW-w64解决
下载地址:https://github.com/niXman/mingw-builds-binaries/releases
安装 x86_64-12.2.0-release-posix-seh-ucrt-rt_v10-rev2 版本,运行代码,报错:
\runtime\cgo/gcc_libinit_windows.c:60: undefined reference to `__imp___iob_func'
解决方法
安装 x86_64-12.2.0-release-posix-seh-msvcrt-rt_v10-rev2.7z 版本,运行成功,推测是 ucrt 版本有问题