我正在遵循某人的指示,我将其存储库克隆到我的机器上。我想使用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 ?
当前回答
我也曾经遇到过同样的问题。但我很惊讶没有找到一个特解。
从GnuWin32或通过winget安装是很好的和简单的选择。但我只找到了3.8.1。这个版本缺少非常重要的选项-O,它在编译多线程时正确地处理输出。
目前,Choco似乎提供4.3。所以我们可以期待最近的版本。
但是也有自编译的选项。如果你必须安装make(用于编译),这应该是一个有效的选项。
head to https://www.gnu.org/software/make/ and download a version of your liking unpack the tar.gz files (use 7zip and unpack the file twice to retrieve the actual content) navigate to the created directory open command prompt in that directory run build_w32.bat gcc This will start the compilation with the gcc compiler, which you would need to install in advance. When running build_w32.bat without any option they try to use the MSVC compiler. Sidenote: I found it surprising that gnu does not use gcc as default but MSVC :-) ignore the warnings created during compilation. The result should still be fine retrieve your fresh gnumake.exe from the directoy GccRel (when compiled with gcc) put this file somewhere where you like and rename to make.exe add the location to the system variable %PATH%
正如其他人所指出的:如果其他程序也安装了各种make版本,那么这种手动安装可能会导致冲突。
其他回答
我可以建议循序渐进的方法。
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
安装Msys2 http://www.msys2.org 遵循安装说明 使用$ pacman -S make gettext base-devel安装make 添加C:\msys64\usr\bin\到您的路径
GNU make可用于巧克力。
从这里安装chocoley。 然后,choco安装make。
现在您将能够在窗口上使用Make。 我试着在MinGW上使用它,但它应该也能在CMD上工作。
Install npm install Node Install Make node install make up node install make If above commands displays any error then install Chocolatey(choco) Open cmd and copy and paste the below command (command copied from chocolatey URL) @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command " [System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
我也曾经遇到过同样的问题。但我很惊讶没有找到一个特解。
从GnuWin32或通过winget安装是很好的和简单的选择。但我只找到了3.8.1。这个版本缺少非常重要的选项-O,它在编译多线程时正确地处理输出。
目前,Choco似乎提供4.3。所以我们可以期待最近的版本。
但是也有自编译的选项。如果你必须安装make(用于编译),这应该是一个有效的选项。
head to https://www.gnu.org/software/make/ and download a version of your liking unpack the tar.gz files (use 7zip and unpack the file twice to retrieve the actual content) navigate to the created directory open command prompt in that directory run build_w32.bat gcc This will start the compilation with the gcc compiler, which you would need to install in advance. When running build_w32.bat without any option they try to use the MSVC compiler. Sidenote: I found it surprising that gnu does not use gcc as default but MSVC :-) ignore the warnings created during compilation. The result should still be fine retrieve your fresh gnumake.exe from the directoy GccRel (when compiled with gcc) put this file somewhere where you like and rename to make.exe add the location to the system variable %PATH%
正如其他人所指出的:如果其他程序也安装了各种make版本,那么这种手动安装可能会导致冲突。