GOLAND编译GO语言程序报错exec: "gcc": executable file not found in %PATH%

时间:2024-03-27 08:20:07

原因:系统没有安装GCC原码编译工具
解决方法如下:

1 下载MinGW

下载地址:https://sourceforge.net/projects/mingw-w64/

2 安装MinGW

GOLAND编译GO语言程序报错exec: "gcc": executable file not found in %PATH%
GOLAND编译GO语言程序报错exec: "gcc": executable file not found in %PATH%
根据系统选择32位或64位
GOLAND编译GO语言程序报错exec: "gcc": executable file not found in %PATH%
安装到默认地址
GOLAND编译GO语言程序报错exec: "gcc": executable file not found in %PATH%
等待安装完成点击finish

3 测试

打开cmd,进入到安装目录的bin目录,如我的目录为:
C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin
然后输入gcc -v
GOLAND编译GO语言程序报错exec: "gcc": executable file not found in %PATH%
安装成功。

4 配置环境变量

进入系统,点击高级系统设置
GOLAND编译GO语言程序报错exec: "gcc": executable file not found in %PATH%
点击环境变量
GOLAND编译GO语言程序报错exec: "gcc": executable file not found in %PATH%
双击path
GOLAND编译GO语言程序报错exec: "gcc": executable file not found in %PATH%
新建一个环境变量,目录为安装目录的bin目录
GOLAND编译GO语言程序报错exec: "gcc": executable file not found in %PATH%
配置完成,重新编译GO程序即可。