我正在遵循某人的指示,我将其存储库克隆到我的机器上。我想使用make命令作为设置代码环境的一部分,但我使用的是Windows。我在网上搜索了一下,但只找到了一个make.exe文件、一个make. 4.1.tar.gz文件(我不知道接下来该怎么处理它)和如何下载MinGW(适用于GNU;但安装后,我没有发现任何提到“make”)。
在没有GNU编译器或相关包的情况下,如何使用Windows中的make ?
我正在遵循某人的指示,我将其存储库克隆到我的机器上。我想使用make命令作为设置代码环境的一部分,但我使用的是Windows。我在网上搜索了一下,但只找到了一个make.exe文件、一个make. 4.1.tar.gz文件(我不知道接下来该怎么处理它)和如何下载MinGW(适用于GNU;但安装后,我没有发现任何提到“make”)。
在没有GNU编译器或相关包的情况下,如何使用Windows中的make ?
当前回答
如果你使用的是Windows 10,它是内置在Linux子系统特性中的。只需要启动一个Bash提示符(按Windows键,然后输入Bash并选择“Bash on Ubuntu on Windows”),cd到你想要制作的目录并输入make。
FWIW, Windows驱动器在/mnt中找到,例如Bash中的C:\ drive是/mnt/ C。
如果Bash在开始菜单中不可用,下面是打开Windows功能(仅限64位Windows)的说明:
https://learn.microsoft.com/en-us/windows/wsl/install-win10
其他回答
如果你使用的是Windows 10,它是内置在Linux子系统特性中的。只需要启动一个Bash提示符(按Windows键,然后输入Bash并选择“Bash on Ubuntu on Windows”),cd到你想要制作的目录并输入make。
FWIW, Windows驱动器在/mnt中找到,例如Bash中的C:\ drive是/mnt/ C。
如果Bash在开始菜单中不可用,下面是打开Windows功能(仅限64位Windows)的说明:
https://learn.microsoft.com/en-us/windows/wsl/install-win10
在windows 10或windows 11操作系统上执行winget install GnuWin32命令。在命令行或powershell中进行Make以快速安装。然后可以使用cmake命令。
没有必要再安装巧克力了。
我可以建议循序渐进的方法。
Visit GNUwin Download the Setup Program Follow the instructions and install GNUWin. You should pay attention to the directory where your application is being installed. (You will need it later1) Follow these instructions and add make to your environment variables. As I told you before, now it is time to know where your application was installed. FYI: The default directory is C:\Program Files (x86)\GnuWin32\. Now, update the PATH to include the bin directory of the newly installed program. A typical example of what one might add to the path is: ...;C:\Program Files (x86)\GnuWin32\bin
一般来说,接受的答案是一个坏主意,因为手动创建的make.exe会一直存在,并可能导致意想不到的问题。它实际上破坏了RubyInstaller: https://github.com/oneclick/rubyinstaller2/issues/105
另一种选择是通过Chocolatey安装make(正如@Vasantha Ganesh K指出的那样)
另一种方法是在Chocolatey上安装MSYS2,在C:\tools\msys64\usr\bin中使用make。如果make没有在MSYS2中自动安装,你需要通过pacman -S make手动安装(正如@Thad Guidry和@Luke指出的那样)。
安装Msys2 http://www.msys2.org 遵循安装说明 使用$ pacman -S make gettext base-devel安装make 添加C:\msys64\usr\bin\到您的路径