我的文档的空白自由路径
在用GNU工具链构建C++项目时,make告诉我~
src/Adapter_FS5HyDE.d:1: *** 多个目标模式。停止。
搜索,搜索,搜索,我发现 make
认为它有多个目标,因为我包含的标头的路径中有空格。如果您将标头存储在某个正常位置,例如C:\Program Files
,那么您可以使用旧的 DOS 路径(例如 C:\PROGRA~1
)。但是,当您将标题放在像 My Documents
这样真正疯狂的地方时,您可以使用 MY DOC~1
解决问题,因为仍然有一个空格。
知道如何告诉我的编译器在“我的文档”中查找标头,而不会使 make
将路径混淆为两个对象吗?
(注:如果您愿意,请随意向我扔西红柿,因为我将头文件放入“我的文档”中,但是这样做有一些我不想解释的理由。如果这个问题的解决方案很简单,我宁愿保持原样。)
In building a C++ project with the GNU tool chain, make tells me ~
src/Adapter_FS5HyDE.d:1: *** multiple target patterns. Stop.
Search, search, search, and I found out that make
thinks that it has multiple targets because the path to my included headers has spaces in it. If you've got your headers stored in some sane place like C:\Program Files
then you can take care of this by using the old DOS paths (e.g. C:\PROGRA~1
). However, when you have your headers in a truly insane place like My Documents
you can get around the problem with MY DOC~1
because there's still a space.
Any idea how to tell my compiler to look in My Documents for headers without make
confusing the path as two objects?
(Note: Feel free to throw tomatoes at me for putting header files in My Documents if you'd like, but there is a little rationale for doing that which I don't feel like explaining. If the solution to this question is easy, I'd rather keep it the way it is.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我具体不知道 make ,但解决这个问题的正常方法是在路径周围加上引号,即
这有效吗?
I don't know about make specficially, but the normal way around this is to put quotes around the path i.e.
does that work?
旁注:同一文件夹的短名称 (8.3) 在不同的操作系统安装上可能不同。因此,您无法确定
C:\Program Files
始终是C:\PROGRA~1
。My Documents
通常的短名称是MYDOCU~1
,而不是MY DOC~1
。dir /x
找到任何文件夹或文件(包括我的文档
)的确切短名称。cmd.exe
) 使用 GNU 工具链,则应该能够在文件夹/文件名周围使用引号 ("
) 来解决问题这个问题。Side note: the short name (8.3) for the same folder might not be the same on different OS installations. Thus, you can't be sure that
C:\Program Files
will always beC:\PROGRA~1
.My Documents
isMYDOCU~1
, notMY DOC~1
.My Documents
) usingdir /x <filename>
.cmd.exe
), you should be able to use quotes ("
) around the folder/file names to work around this problem.对于某些文件夹(包括“我的文档”),您可以指定备用位置。为此,右键单击该文件夹,选择“属性”,选择“位置”选项卡,然后就可以了。我用它把我的下载和音乐放在另一个驱动器(D:)上。
For some folders, including My Documents, you can specify an alternative location. To do this, right-click the folder, select Properties, select Location tab, and away you go. I use this to put my downloads and music on another drive (D:).
编写一个包装脚本(例如批处理文件)将路径名转换为缩写形式。
我有一个脚本“runwin”可以执行类似的操作 - 而不是例如
gcc
我可以调用runwin gcc
;runwin 将启发式猜测哪些参数是文件名路径并翻译它们,然后对生成的参数字符串调用 gcc。
Write a wrapper script (e.g. batchfile) to translate the path names to short form.
I have a script "runwin" that does stuff like this - instead of, e.g.
gcc <args>
I can callrunwin gcc <args>
;runwin will make heuristic guesses as to which arguments are filename paths and translate them, then call gcc on the resulting string of arguments.
您可以通过在命令提示符中执行
DIR /X
来找出旧路径。或者,大多数时候你可以用前 6 个字符来伪造它 - 空格 +
~1
+ 扩展名(8.3 路径不会有空格)。或者,您可以使用引号:
“C:\Documents and Settings\Administrator\My Documents”
。You can figure out what the old path is by doing a
DIR /X
in your command prompt.Or, most of the time you can fake it with the first 6 characters - spaces +
~1
+ extension (8.3 paths won't have spaces).Or, you can use quotes:
"C:\Documents and Settings\Administrator\My Documents"
.