admin 管理员组

文章数量: 1184232

        在windows上尝试makefile的可以试一试。

        注意需要下载好mingw、配置好gcc路径,才能成功使用make

方法一:

从官网下载 make.exe Make for Windows

官网首页:https://www.gnu/software/make/

下载地址:

https://gnuwin32.sourceforge

点击框中的下载,下载后安装。把安装路径添加到环境变量 PATH 中.

[注: 系统环境变量路径:C:\Program Files (x86)\GnuWin32\bin]

在终端,执行以下命令,将出现Make版本信息:

C:\Users\dell>make -v
GNU Make 4.4.1
Built for Windows32
Copyright (C) 1988-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

方法二:

1.命令行安装chocolatey,使用choco install 安装make 命令
管理员权限启动cmd.exe,输入以下指令安装chocolatey

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


之后就可以用类似linux中apt-get的方式安装各种工具,此处用choco install安装make工具

choco install make

 在终端,执行以下命令,将出现Make版本信息:

C:\Users\dell>make -v
GNU Make 4.4.1
Built for Windows32
Copyright (C) 1988-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

之后找到Makefile路径,使用make命令即可

make
或
make -f MakeFileOtherName.xx

本文标签: 命令行 mingw Windows