0

I recently installed MinGW and learnt how to use Make. But I get an error whenever I try to compile a CPP source file using make. Below is the output:

MAKE Version 3.6  Copyright (c) 1991 Borland International

Available memory 33397872 bytes

        mingw32-g++ main.cpp --std=c++11 -o program
Bad command or file name

The main.cpp is a very simple "Hello World" type program. The command works when I use it in the Command Prompt directly.
I am running Windows 8.1 with MinGW. GCC version 4.8

2 Answers2

2

I think you would like to learn GNU make, not Borland one from 1991.

Make sure you installed GNU make package in Cygwin. Check that it is present by typing in the bash command line:

$ type -a make

It should respond with something like:

/usr/bin/make
/bin/make

And then:

$ make --version

Which should respond with something like:

GNU Make 4.1
Built for x86_64-unknown-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Maxim Egorushkin
  • 131,725
  • 17
  • 180
  • 271
1

As another respondent has noted, you should not be trying to coax Borland's antique make into working with MinGW; the most appropriate option for you would be either mingw32-make, (a native windows build of GNU make suitable for use directly from a cmd.exe shell session), or install MinGW.org's MSYS, and use the make which it provides; either of these may be installed using MinGW.org's mingw-get installation manager.

Either of these options should work for you, while avoiding the bloat of Cygwin, (or the equally bloated MSYS2, which should not be confused with the MinGW.org MSYS product). Do note that, if you choose the MSYS option, you will be installing a very light-weight fork of an old, but still perfectly adequate and capable, version of Cygwin.

In closing, to clear up your evident confusion, I would also point out that the g++.exe which you find in the $MINGW32_ROOT/bin directory, and the mingw32-g++.exe to which you refer, are one and the same -- both are the MinGW compiler, and you would normally invoke it simply as g++.

Keith Marshall
  • 1,980
  • 15
  • 19
  • Thanks for you answer. Only now I realized that make and mingw32-make weren't the same command. I had also installed Turbo C++ for research purposes and added its folder to my PATH variable. After reading your answer, I changed my command. Thanks very much. – Vishal Subramanyam Sep 16 '15 at 08:39