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

242,529

Solution 1

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.

Solution 2

In Windows10, I solved this issue by adding C:\MinGW\bin to Path and then called it using MinGW32-make not make.

Solution 3

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 piece of software from a set of source files and libraries; 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 list 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 already exists and 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.

Solution 4

  1. First make sure you have MinGW installed.
  2. From MinGW installation manager check if you have the mingw32-make package installed.
  3. Check if you have added the MinGW bin folder to your PATH. type PATH in your command line and look for the folder. Or on windows 10 go to Control Panel\System and Security\System --> Advanced system settings --> Environment Variables --> System Variables find Path variable, select, Edit and check if it is there. If not just add it!
  4. As explained here, create a new file in any of your PATH folders. For example create mingwstartup.bat in the MinGW bin folder. write the line doskey make=mingw32-make.exe inside, save and close it.
  5. open Registry Editor by running regedit. As explained here in HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER go to \Software\Microsoft\Command Processor right click on the right panel New --> Expandable String Value and name it AutoRun. double click and enter the path to your .bat file as the Value data (e.g. "C:\MinGW\bin\mingwstartup.bat") the result should look like this:

enter image description here

now every time you open a new terminal make command will run the mingw32-make.exe. I hope it helps.

P.S. If you don't want to see the commands of the .bat file to be printed out to the terminal put @echo off at the top of the batch file.

Solution 5

If you already have MinGW installed in Windows 7, just simply do the following:

  1. Make another copy of C:\MinGW\bin\mingw32-make.exe file in the same folder.
  2. Rename the file name from mingw32-make.exe to make.exe.
  3. Run make command again.

Tested working in my laptop for above steps.

Share:
242,529
programmer
Author by

programmer

Updated on July 09, 2022

Comments

  • programmer
    programmer almost 2 years

    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 -> make, which outputs:

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

    Then I typed 'mingw32-make' instead of 'make' (Start -> cmd -> run -> mingw32-make) and I get the same output:

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

    What shall I do next in order to fix this problem?

  • foxidrive
    foxidrive almost 10 years
    nmake is not a default command either - in Win 8.1 32 bit at least.
  • programmer
    programmer almost 10 years
    nmake is not recognised as well
  • programmer
    programmer almost 10 years
    I donwloaded 'make-3.81.exe' from the following link : link. I executed the 'make-3.81.exe' and a new folder 'GnuWin32' was created under C:\Program Files (x86)\. Then in Windows 7 I did: Start -> cmd -> cd C:\Program Files (x86)\GnuWin32\bin -> make (typed 'make') and the command was recognized. Afterwards I editted the PATH environment variable as you told me and the problem was solved! The 'make' command is now recognized by the system. Thanks for your help!
  • mvd
    mvd over 9 years
    You need to have visual studio installed to have nmake. Windows does not come with this program by default.
  • Paul Wintz
    Paul Wintz about 7 years
    I have Visual Studio installed, but nmake is not recognized as a command.
  • Tom Hall
    Tom Hall about 6 years
    I was trying to install nio4r-2.2.0 gem and just copied the mingw32-make program and renamed it to make and then installed the gem just fine.
  • stephenbayer
    stephenbayer almost 6 years
    use the developer command prompt, it will have the proper paths added to your command window
  • Gibolt
    Gibolt over 5 years
    This answer could use some clarification
  • jpp
    jpp over 5 years
    Why should this work? Can you provide an explanation?
  • tripleee
    tripleee almost 5 years
    cmake is a completely different tool.
  • jeea
    jeea almost 4 years
    or maybe do the second step then add make to path (environment variable) then step 3
  • 14all41
    14all41 over 3 years
    Thanks @Gibolt , could u tell me what's unClear? We just need2 run it. What else do u need?
  • back2Lobby
    back2Lobby over 3 years
    for me it was mingw32-make
  • Piotr Wasilewicz
    Piotr Wasilewicz over 3 years
    Yes, that finally works. Maybe it isn't great when you open cmd and every time see doskey make=mingw32-make.exe but in fact it is really nice trick.
  • Foad S. Farimani
    Foad S. Farimani over 3 years
    @PiotrWasilewicz check the P.S.
  • T.Todua
    T.Todua about 3 years
    Here homepage for Make. (huh, seems so old app).
  • tripleee
    tripleee almost 3 years
    Of course, the vcproj option requires that you have Visual Studio or a similar product. If you are reading this, you are obviously already a Microsoft victim, but maybe hesitate to dig yourself deeper into that particular hole.
  • DikShU
    DikShU almost 3 years
    what path are you teklling here
  • tripleee
    tripleee over 2 years
    I'm not Gibolt, but it's unclear what scoop is or why one would want to install that when that's not the question. Several of the other variables here seem tangential or coincidental at best, and it's not evident whether this actually answers the question at the top of this page.
  • Tertius Geldenhuys
    Tertius Geldenhuys over 2 years
    VirusTotal flagged this one virustotal.com/gui/file/…