How to install and use “make” in Windows?

2020-02-02 04:18发布

I'm following the instructions of someone whose repository I cloned to my machine. What I want is simple: to be able to use the make command as part of setting up the code environment. But I'm using Windows, and I searched online only to find a make.exe file to download, a make-4.1.tar.gz file to download (I don't know what to do with it next), and things about downloading MinGW (for GNU; but after installing it I didn't find any mention of "make").

I don't want a GNU compiler or related stuff; I only want to use "make" in Windows. Please tell me what I should do to accomplish that.

Thanks in advance!

7条回答
聊天终结者
2楼-- · 2020-02-02 04:21

GNU make is available on chocolatey.

  • Install chocolatey from here.

  • Then, choco install make.

Now you will be able to use Make on windows.
I've tried using it on MinGW, but it should work on CMD as well.

查看更多
劳资没心,怎么记你
3楼-- · 2020-02-02 04:21

The accepted answer is a bad idea in general because the manually created make.exe will stick around and can potentially cause unexpected problems. It actually breaks RubyInstaller: https://github.com/oneclick/rubyinstaller2/issues/105

An alternative is installing make via Chocolatey (as pointed out by @Vasantha Ganesh K)

Another alternative is installing MSYS2 from Chocolatey and using make from C:\tools\msys64\usr\bin. If make isn't installed automatically with MSYS2 you need to install it manually via pacman -S make (as pointed out by @Thad Guidry and @Luke).

查看更多
一夜七次
4楼-- · 2020-02-02 04:23

make is a GNU command so the only way you can get it on Windows is installing a Windows version like the one provided by GNUWin32. Or you can install MinGW and then do:

copy c:\MinGW\bin\mingw32-make.exe c:\MinGW\bin\make.exe

or create a link to the actual executable, in your PATH. In this case, if you update MinGW, the link is not deleted:

mklink c:\bin\make.exe C:\MinGW\bin\mingw32-make.exe

Other option is using Chocolatey. First you need to install this package manager. Once installed you simlpy need to install make:

choco install make.

Last option is installing a Windows Subsystem for Linux (WSL), so you'll have a Linux distribution of your choice embedded in Windows 10 where you'll be able to install make, gccand all the tools you need to build C programs.

查看更多
Ridiculous、
5楼-- · 2020-02-02 04:30

If you're using Windows 10, it is built into the Linux subsystem feature. Just launch a Bash prompt (press the Windows key, then type bash and choose "Bash on Ubuntu on Windows"), cd to the directory you want to make and type make.

FWIW, the Windows drives are found in /mnt, e.g. C:\ drive is /mnt/c in Bash.

If Bash isn't available from your start menu, here are instructions for turning on that Windows feature (64-bit Windows only):

https://docs.microsoft.com/en-us/windows/wsl/install-win10

查看更多
仙女界的扛把子
6楼-- · 2020-02-02 04:31

Another alternative is if you already installed minGW and added the bin folder the to Path environment variable, you can use "mingw32-make" instead of "make".

You can also create a symlink from "make" to "mingw32-make", or copying and changing the name of the file. I would not recommend the options before, they will work until you do changes on the minGW.

查看更多
贼婆χ
7楼-- · 2020-02-02 04:32
  1. Install Msys2 http://www.msys2.org
  2. Follow installation instructions
  3. Install make with $ pacman -S make gettext base-devel
  4. Add C:\msys64\usr\bin\ to your path
查看更多
登录 后发表回答