make problem with mingw - windows

I have a small problem with make and mingw. I usually use Linux and I am not really familiar with windows way of doing.
C:\MingGW\bin is in my path (I can launch directly g++ or sh by the windows command line) but when I try to type make I have the following error :
make: g++: command not found
I do not know which make is use (no make in C:\MinGw\bin) and I do not know the equivalent of which in windows. Do I have forgotten an essential step ?
Thanks for your help.

Try mingw32-make instead.

Use this command to find out which one you're running:
for %i in (make.exe) do #echo. %~$PATH:i
It's basically the equivalent of which for Windows, assuming you know the extension. If you want a script that will check all extensions, you can find it here.
As pointed out in a comment by Chris, latter versions of Windows (Vista, 2003 Server, and Win7, I think) actually have a real equivalent called where, which may be better. Those of us still stuck back on XP can use the command above (or the big script at the other end of that link).

Are you sure there is no make ? Once do "where make" to confirm this and check the entries you get under C:\mingW\bin. Hopefully you will get a entry mingw-32-make.exe or something like that.
All you need to do is rename (better create a copy and rename) this exe as make.exe and if you have already added the environment variable of this path then you may now be able to issue make command happily under mingw.
The same is already done for g++,gcc, etc. They might have conveniently left make the way it is. Hope this helps

Related

Configure make command for fortran in Geany

sorry if it's a simple question, I'm a bit of a rookie and couldn't find the answer online.
I have a program in Fortran with a makefile that I need to run. I am able to run it through the terminal, by using mingw32-make command, but I'd like to do be able to do it through Geany as well.
When I just try to do it by pressing Make in Geany, nothing happens and a message at the bottom of the screen says Process failed (The system cannot find the file specified). From what I gather, I need to configure a new make command in Geany through Set build commands and that might solve the problem, but this is where I am lost. What exactly do I need to type in there? Do I need to direct it to mingw32-make? How do I do that?
This is what my Set Build commands window looks like now.
Thanks!
Two options
In your fortran bin directory copy mingw32_make.exe to make.exe.
In geany, change make to mingw32_make
The make in geany should then work.

How to launch babun in a specified directory via the command line

now I'm currently using Visual Studio Code and I wanted to make the terminal use babun instead of the default cmd.exe
In fact, I have already managed to do that in theory - the problem is that, unlike with cmd.exe, the directory that I'm in upon starting the terminal is no longer the currently open project, it's just simply /home/myusername (i.e. a path in babun's directory tree).
This kinda sucks, since I don't really want to navigate to my directory every time.
Next, I also found out how to tell babun (in my case, zsh.exe) to use a default directory such as C:/ by adding cd /cygdrive/c to the end of .zshrc - Unfortunately, that's not what I want either, since I don't want babun to always use the same directory.
Now I figured that, seeing as this would be the most comfortable option with VSC*, there might be some console argument that tells zsh.exe to use a specific directory. Sadly, I couldn't find anything, hence this question.
Weirdly enough
Anyone know how to help me out? Appreciate the help :)
*VSC allows you to specify the path to your shell, as well as an array of arguments that will be passed.
You could place your directory into a cmd file and run it as a shell:
d:
#rem note that's important to change the drive 'permanently'
cd d:\home
zsh.exe
And then specify this cmd file as shell to invoke.
Open the desired directory in a file explorer, right click, then select Open Babun here.
Babun currently does not natively support a command line parameter specifying the directory to launch in.
However, there is a pull request in the Babun GitHub which solves the issue. Unfortunately, it doesn't seem to be likely to be accepted anytime soon, though.
To gain access to the feature manually, check out the pull request.

Makefile.mak giving error [duplicate]

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?
In Windows10, I solved this issue by adding C:\MinGW\bin to Path and then called it using MinGW32-make not make.
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.
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.
First make sure you have MinGW installed.
From MinGW installation manager check if you have the mingw32-make package installed.
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!
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.
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:
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.
If you already have MinGW installed in Windows 7, just simply do the following:
Make another copy of C:\MinGW\bin\mingw32-make.exe file in the same folder.
Rename the file name from mingw32-make.exe to make.exe.
Run make command again.
Tested working in my laptop for above steps.
For window-10 resolved error- make' is not recognized as an internal or external command.
Download MinGW - Minimalist GNU for Windows from here https://sourceforge.net/projects/mingw/
install it
While installation mark all basic setup packages like shown in image
Apply changes
After completion of installation
copy C:\MinGW\bin
paste in system variable
Open MyComputer properties and follow as shown in image
You may also need to install this
https://sourceforge.net/projects/gnuwin32/
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.
'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.
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
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!
try download & run my bat code
======run 'cmd' as admin 2 use 'setx'=====
setx scoop "C:\Users%username%\scoop" /M
echo %scoop%
setx scoopApps "%scoop%\apps" /M
echo %scoopApps%
scoop install make
=======Phase 3: Create the makePath environment variable===
setx makePath "%scoopApps%/make" /M
echo %makePath%
setx makeBin "%makePath%/Bin" /M
echo %makeBin%
setx Path "%Path%;%makeBin%" /M
echo %Path%
use mingw32-make instead of cmake in windows

.bat script for running jmx console: problems with paths

I've been struggling to create a .bat script for Windows for running the JMX console. I've managed to do it with some tricks, but there must be something very wrong I'm doing and I haven't found a solution after investigating and googling quite a bit, and many trials. If this question is a duplicate, I'll be happy to remove it.
This is my original script (an attempt to translate the script that I have running for Mac and Linux)
%JAVA_HOME%\bin\jconsole.exe -J-Djava.class.path=%JAVA_HOME%\lib\jconsole.jar;%JAVA_HOME%\lib\tools.jar;%MY_JCONSOLE_PATH%\opendmk_jmxremote_optional_jar-1.0-b01-ea.jar service:jmx:jmxmp://<host>:<port>
The problems that I've faced:
jconsole.exe does not seem to run properly unless I do a cd to $JAVA_HOME\bin
cannot make the script (or maybe the jconsole) understand %JAVA_HOME%\lib, and I had to add a new environment variable
This is my working version to address the problems above:
set MY_PATH=%cd%
cd %JAVA_HOME%\bin
jconsole.exe -J-Djava.class.path=%JAVA_BIN%\jconsole.jar;%JAVA_BIN%\tools.jar;%MY_PATH%\opendmk_jmxremote_optional_jar-1.0-b01-ea.jar service:jmx:jmxmp://<host>:<port>
But it is not very clean and I'd just like to know what mistake(s) I'm doing. I'd just like to know!
Many thanks!
Sometimes you leave a problem for a couple of days and with a fresh mind you solve it... in case it helps anybody, solution is as follows,
set MY_PATH=%cd%
"%JAVA_HOME%\bin\jconsole.exe" -J"-Djava.class.path=%JAVA_HOME%\lib\jconsole.jar;%JAVA_HOME%\lib\tools.jar;%MY_PATH%\opendmk_jmxremote_optional_jar-1.0-b01-ea.jar" service:jmx:jmxmp://<host>:<port>
The problem seems to be related to the fact that the directory Program Files has a space on it, however the double quotes " cannot be put just anywhere (e.g. I tried to define the environment variable JAVA_HOME as C:\"Program Files"\Java\jdk... but that did not help.

make is not recognized as an internal or external command - Qt SDK - Windows

I installed Qt through Qt-SDK 2010.01.
How to run make on Qt's terminal now?
I have set the System path:
Qt path command prompt:
Please help. :( :(
You should run mingw32-make instead of make.
If you want to be able to call it via make for simplicity, you might want to define an "alias" which runs mingw32-make. While I'm not very familiar with the CMD in windows, I think this should be possible with the following command:
set make=mingw32-make
However, I don't think this will be permanent. You might want to try to add a batch file make.bat in ...\mingw\bin which runs mingw32-make to achieve this. This batch file would however need to "forward" all additional arguments to mingw32-make. Maybe there are better ways to create a permanent alias, I don't know.
Maybe you also want to try the DOSKEY utility program to create a permanent alias.

Resources