windows - mingw make 无法处理路径中的空格?

标签 windows makefile mingw

我正在尝试编译代码,即使用 qmake 创建的 makefile。 当我运行 mingw32-make 时,出现以下错误:

cd bzip2-1.0.5\ && c:\QtSDK\Desktop\Qt\4.7.3\mingw\bin\qmake.exe c:\Documents an
d Settings\user\My Documents\Visual Studio 2010\Projects\meshlab\meshlab\meshla
b\src\external\bzip2-1.0.5\bzip2-1.0.5.pro -o Makefile
Cannot find file: c:\Documents.
Cannot find file: and.
Cannot find file: Settings\user\My.
Cannot find file: Documents\Visual.
Cannot find file: Studio.
Cannot find file: 2010\Projects\meshlab\meshlab\meshlab\src\external\bzip2-1.0.5
\bzip2-1.0.5.pro.
mingw32-make: *** [bzip2-1.0.5\Makefile] Error 2

根据错误,mingw32-make 似乎无法理解其中包含空格的路径。真的吗?有办法解决吗?

最佳答案

在 Linux/UNIX 中常见的做法是用反斜杠转义每个空格,例如:/c/Documents\ and\ Settings/User但是,这在 MinGW 中并不总是有效。

因此,请使用短 (8.3) 名称。您可以使用 Windows(不是 MinGW)命令获得短名称 for %I in (<PATH>) do @echo %~sI其中 <PATH>可以是. (显示当前目录,如 pwd),* (列出当前目录中的文件)、特定文件路径等。

顺便说一句,要从可怕的 cmd.exe 窗口复制,请单击标题栏左上角的图标,转到“属性”、“选项”,然后启用“快速编辑模式”。然后你可以用鼠标选择文本。 Enter 键(或菜单>编辑>复制)将文本复制到剪贴板。插入键(或菜单>编辑>粘贴)将其粘贴。

关于windows - mingw make 无法处理路径中的空格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5999507/

相关文章:

c++ - 交叉编译中的 MinGW vs MinGW-W64 vs MSVC (VC++)

c++ - COM : convert 'const GUID*' to const wchar_t*

c - gcc 编译器和 makefile : error: expected identifier or ‘(’ before ‘&’ token

windows - IsFile、IsDirectory 测试窗口

c - Windows 上的 read() 系统调用无法读取二进制文件

windows - 在特定参数上启用/禁用 USB 端口

在不同文件上使用差异时,Makefile 失败

c++ - 使用 qmake 查找编译器供应商/版本

c++ - Mingw g++ 在其他 IDE 和 Ubuntu g++ 中运行时显示垃圾输出

c - 如何在 Windows 10 上安装 Dr Memory