windows下安装make,使用makefile文件

简介: windows下安装make,使用makefile文件

前言

本人在学习go-micro中,用到Makefile,本人之前用过Makefile,但是不知道为什么这会就不能用了,我找了好多教程都没能解决问题,大多数是linux的安装教程,另一部分是下载mingw,但是没能解决我的问题,最后花了我一下午的时间才解决,特此记录一下,给其他的小伙伴提个醒,希望能够解决大家的make安装问题。


Makefile简介

当用户编译文件过多的时候,使用makefile可以帮助模块化编译文件,makefile是一个脚本文件,根据规则,来执行相应的脚本文件,实现自动化编译。


make作用

想要使用Makefile文件,首先需要确保本地可以使用make命令,如果没有安装make,goland编译器会出现报错:

> Error running 'docs': Cannot run program "\usr\bin\make" (in directory
> "F:\xx\goland-api\xxxx-go"...

安装make:

1.windows上安装:chocolatey

一、Chocolatey介绍

Chocolatey是一款专为Windows系统开发的、基于NuGet的包管理器工具,类似于Node.js的npm,MacOS的brew,Ubuntu的apt-get,它简称为choco。Chocolatey的设计目标是成为一个去中心化的框架,便于开发者按需快速安装应用程序和工具。


Chocolatey的官网: https://chocolatey.org/


二、Chocolatey安装

要安装Chocolatey很容易,必须以管理员权限打开cmd命令行提示,执行如下内容:

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

还有一种安装方法,使用PowerShell,同样必须以管理员权限打开PowerShell,执行如下命令

iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))

安装make

安装完成chocolatey后,在cmd或者PowerShell中执行:

choco install make

配置make连接

然后golang 的setting菜单搜索make 配置make的路径:

make的安装路径是:C:\ProgramData\chocolatey\bin\make.exe

25.png

之后就可以使用make了!

26.png



相关文章
|
6天前
|
数据安全/隐私保护 Windows
安装 Windows Server 2019
安装 Windows Server 2019
|
6天前
|
Windows
安装 Windows Server 2003
安装 Windows Server 2003
|
7天前
|
NoSQL Shell MongoDB
Windows 平台安装 MongoDB
10月更文挑战第10天
16 0
Windows 平台安装 MongoDB
|
10天前
|
Windows Python
Windows安装dlib,遇到问题汇总解决
Windows安装dlib,遇到问题汇总解决
20 4
|
14天前
|
Oracle 关系型数据库 MySQL
Mysql(1)—简介及Windows环境下载安装
MySQL 是一个流行的关系型数据库管理系统(RDBMS),基于 SQL 进行操作。它由瑞典 MySQL AB 公司开发,后被 Sun Microsystems 收购,现为 Oracle 产品。MySQL 是最广泛使用的开源数据库之一,适用于 Web 应用程序、数据仓库和企业应用。
46 2
|
15天前
|
JavaScript Windows
windows安装vue
windows安装vue
|
16天前
|
应用服务中间件 Apache Windows
免安装版的Tomcat注册为windows服务
免安装版的Tomcat注册为windows服务
25 3
|
16天前
|
存储 开发框架 .NET
Windows IIS中asp的global.asa全局配置文件使用说明
Windows IIS中asp的global.asa全局配置文件使用说明
27 1
|
6天前
|
Windows
安装Windows XP系统
安装Windows XP系统
|
15天前
|
Ubuntu Linux 开发工具
windows11安装WLS2+Ubuntu
windows11安装WLS2+Ubuntu