我正在遵循某人的指示,我将其存储库克隆到我的机器上。我想使用make命令作为设置代码环境的一部分,但我使用的是Windows。我在网上搜索了一下,但只找到了一个make.exe文件、一个make. 4.1.tar.gz文件(我不知道接下来该怎么处理它)和如何下载MinGW(适用于GNU;但安装后,我没有发现任何提到“make”)。

在没有GNU编译器或相关包的情况下,如何使用Windows中的make ?


当前回答

安装Msys2 http://www.msys2.org 遵循安装说明 使用$ pacman -S make gettext base-devel安装make 添加C:\msys64\usr\bin\到您的路径

其他回答

GNU make可用于巧克力。

从这里安装chocoley。 然后,choco安装make。

现在您将能够在窗口上使用Make。 我试着在MinGW上使用它,但它应该也能在CMD上工作。

我可以建议循序渐进的方法。

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

从他们的官方网站GnuWin32下载make.exe

在下载会话中,单击 完整的包,除了源代码。 按照安装说明安装。 完成后,将<安装目录>/bin/添加到PATH变量中。

现在您将能够在cmd中使用make。

另一种选择是,如果你已经安装了minGW,并添加了bin文件夹的to Path环境变量,你可以使用“mingw32-make”而不是“make”。

你也可以创建一个从"make"到"mingw32-make"的符号链接,或者复制并更改文件名。我不推荐之前的选项,他们会工作,直到你对minGW做改变。

如果你想使用命令行模拟器cder,一个解决方案可能会有帮助。您可以随意地安装包安装程序。首先,我们在windows命令提示符中使用以下行安装chocately:

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
refreshenv

在安装了chocolatey之后,可以使用choco命令来安装make。安装完成后,你需要在/ cder /config/user_alias .cmd中添加一个别名。应增加以下一行:

make="path_to_chocolatey\chocolatey\bin\make.exe" $*

然后,Make将在cmder环境中操作。