mingw make can't handle spaces in path?

From the MinGW "Getting Started" guide:

MinGW may have problems with paths containing spaces, and if not, usually other programs used with MinGW will experience problems with such paths. Thus, we strongly recommend that you do not install MinGW in any location with spaces in the path name reference; i.e. you should avoid installing into any subdirectory of "Program Files" or "My Documents", or the like.

I suspect the same problems found in running executable files will also manifest itself with other files as well. You could try wrapping the whole thing (file specification) inside double quotes and this may work but Windows is sometimes not as logical as UNIX-based shells in this area.


Spaces in file names are evil anyway :-)


The common way to do it in Linux/UNIX is to escape each space with a backslash, like: /c/Documents\ and\ Settings/User However, this doesn't always work in MinGW.

So, use the short (8.3) name. You get the short name with the Windows (not MinGW) command for %I in (<PATH>) do @echo %~sI where <PATH> can be . (show current directory, like pwd), * (list files in current directory), a particular file path, etc.

Btw, to copy from the awful cmd.exe window, click the icon in the upper-left corner of the title bar, go to Properties, Options, and enable QuickEdit Mode. Then you can select text with your mouse. The Enter key (or menu>Edit>Copy) copies the text to the clipboard. The insert key (or menu>Edit>Paste) pastes it.


Not sure if this helpful or not (in fear of being downvoted), but I created a semantic link in order to avoid paths with spaces. Not sure if it will solve the problem since in my scenario it displayed a different error after I used the semantic link relating to pthreads which I still haven't been able to fix.

Creating semantic link using the command prompt:

mklink /j "C:\newshortcut" "C:\Program Files\Directory with spaces"

Then on the command you want to run, you use C:\newshortcut