栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

cgo: C compiler “gcc“ not found: exec: “gcc“: executable file not found in %PATH%

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

cgo: C compiler “gcc“ not found: exec: “gcc“: executable file not found in %PATH%

cgo: C compiler "gcc" not found: exec: "gcc": executable file not found in %PATH%
  • 问题描述
  • 原因分析
  • 解决方案
  • 参考链接

问题描述
  • 场景描述

    win10系统搭建的golang开发环境,版本是go version go1.17.2 windows/amd64,采用gongland作为开发工具,编写的main.go文件,执行main方法时报错,采用命令执行也是同样问题

  • 报错信息

        cgo: C compiler "gcc" not found: exec: "gcc": executable file not found in %PATH%
    
    
    
原因分析
  • 缺少gcc编译器

    简单执行fmt方法时正常,后来由于引入的新的包,导致需要c语言编译环境,而系统缺少相关安装环境,所以执行失败。

解决方案
  • 下载MinGW-w64安装包并配置系统环境变量

    官网地址:https://sourceforge.net/projects/mingw-w64/files/

参考链接
  • Windows环境golang程序开发 报错exec: gcc: executable file not found in %PATH%

    https://blog.csdn.net/Lyon_Nee/article/details/106840502

  • MinGW-w64 离线包安装方法

    https://blog.csdn.net/weixin_36466834/article/details/119569365

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/384374.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号