Windows 7 - 'make' is not recognized as an internal or external command, operable program or batch file

前端 未结 12 1712
名媛妹妹
名媛妹妹 2020-11-28 11:59

I have Windows 7 and tried to use the \'make\' command but \'make\' is not recognized as an internal or external command.

I did Start -> cmd -> run ->

相关标签:
12条回答
  • 2020-11-28 12:12

    Your problem is most likely that the shell does not know where to find your make program. If you want to use it from "anywhere", then you must do this, or else you will need to add the full path each time you want to call it, which is quite cumbersome. For instance:

    "c:\program files\gnuwin32\bin\make.exe" option1=thisvalue option2=thatvalue
    

    This is to be taken as an example, it used to look like something like this on XP, I can't say on W7. But gnuwin32 used to provide useful "linux-world" packages for Windows. Check details on your provider for make.

    So to avoid entering the path, you can add the path to your PATH environment variable. You will find this easily. To make sure it is registered by the OS, open a console (run cmd.exe) and entering $PATH should give you a list of default pathes. Check that the location of your make program is there.

    0 讨论(0)
  • 2020-11-28 12:13

    I am using windows 8. I had the same problem. I added the path "C:\MinGW\bin" to system environment variable named 'path' then it worked. May be, you can try the same. Hope it'll help!

    0 讨论(0)
  • 2020-11-28 12:17

    Search for make.exe using the search feature, when found, note down the absolute path to the file. You can do that by right-clicking on the filename in the search result and then properties, or open location folder (not sure of the exact wording, I'm not using an English locale).

    When you open the command line console (cmd) instead of typing make, type the whole path and name, e.g. C:\Windows\System32\java (this is for java...).

    Alternatively, if you don't want to provide the full path each time, then you have to possibilities:

    • make C:\Windows\System32\ the current working directory, using cd at cmd level.
    • add C:\Windows\System32\ to you PATH environment variable.

    Refs:

    • use full path: http://technet.microsoft.com/en-us/magazine/ff678296.aspx
    • cd: http://technet.microsoft.com/en-us/library/cc731237.aspx
    • PATH: http://technet.microsoft.com/en-us/library/bb490963.aspx
    0 讨论(0)
  • 2020-11-28 12:18

    As other answers already suggested, you must have MinGW installed. The additional part is to add the following two folders to the PATH environment variable.

    • C:\MinGW\bin
    • C:\MinGW\msys\1.0\bin

    Obviously, adjust the path based on where you installed MinGW. Also, dont forget to open a new command line terminal.

    0 讨论(0)
  • 2020-11-28 12:20

    This is an old question, but none of the answers here provide enough context for a beginner to choose which one to pick.

    What is make?

    make is a traditional Unix utility which reads a Makefile to decide what programs to run to reach a particular goal. Typically, that goal is to build a single piece of software; but make is general enough to be used for various other tasks, too, like assembling a PDF from a collection of TeX source files, or retrieving the newest versions of each of a set of web pages.

    Besides encapsulating the steps to reach an individual target, make reduces processing time by avoiding to re-execute steps which are already complete. It does this by comparing time stamps between dependencies; if A depends on B but A is newer than B, there is no need to make A. Of course, in order for this to work properly, the Makefile needs to document all such dependencies.

    A: B
        commands to produce A from B
    

    Notice that the indentation needs to consist of a literal tab character. This is a common beginner mistake.

    Common Versions of make

    The original make was rather pedestrian. Its lineage continues to this day into BSD make, from which nmake is derived. Roughly speaking, this version provides the make functionality defined by POSIX, with a few minor enhancements and variations.

    GNU make, by contrast, significantly extends the formalism, to the point where a GNU Makefile is unlikely to work with other versions (or occasionally even older versions of GNU make). There is a convention to call such files GNUmakefile instead of Makefile, but this convention is widely ignored, especially on platforms like Linux where GNU make is the de facto standard make.

    Telltale signs that a Makefile uses GNU make conventions are the use of := instead of = for variable assignments (though this is not exclusively a GNU feature) and a plethora of functions like $(shell ...), $(foreach ...), $(patsubst ...) etc.

    So Which Do I Need?

    Well, it really depends on what you are hoping to accomplish.

    If the software you are hoping to build has a vcproj file or similar, you probably want to use that instead, and not try to use make at all.

    In the general case, MinGW make is a Windows port of GNU make for Windows, It should generally cope with any Makefile you throw at it.

    If you know the software was written to use nmake and you already have it installed, or it is easy for you to obtain, maybe go with that.

    You should understand that if the software was not written for, or explicitly ported to, Windows, it is unlikely to compile without significant modifications. In this scenario, getting make to run is the least of your problems, and you will need a good understanding of the differences between the original platform and Windows to have a chance of pulling it off yourself.

    In some more detail, if the Makefile contains Unix commands like grep or curl or yacc then your system needs to have those commands installed, too. But quite apart from that, C or C++ (or more generally, source code in any language) which was written for a different platform might simply not work - at all, or as expected (which is often worse) - on Windows.

    0 讨论(0)
  • 2020-11-28 12:21

    'make' is a command for UNIX/Linux. Instead of it, use 'nmake' command in MS Windows. Or you'd better use an emulator like CYGWIN.

    0 讨论(0)
提交回复
热议问题