简体   繁体   English

Ant/Make 编译错误,文件路径有空格

[英]Ant/Make Compilation Error with File Path Having Spaces

Unable to produce some MVC to reproduce the issue.无法生成一些 MVC 来重现该问题。 So trying to be clear & concise.所以尽量简洁明了。

  1. We utilize ant/make我们利用ant/make

  2. The include path to building the C++ portion utilizes a header (jni.h) from the java installed directory构建 C++ 部分的包含路径使用 java 安装目录中的标头 (jni.h)

Example Error (During Build Process)示例错误(在构建过程中)

3) 3)

*File.h(2): fatal error C1083: Cannot open include file: 'jni.h': No such file or directory
make: *** [File.obj] Error 2*

Another error also shown is:还显示的另一个错误是:

cl : Command line warning D9024 : unrecognized source file type 'Files\Java\jdk1.8.0_281\include', object file assumed

cl : Command line warning D9027 : source file 'Files\Java\jdk1.8.0_281\include' ignored

cl : Command line warning D9024 : unrecognized source file type 'Files\Java\jdk1.8.0_281\include\win32', object file assumed

cl : Command line warning D9027 : source file 'Files\Java\jdk1.8.0_281\include\win32' ignored
  1. This is the include path as part of the compilation step (Yes this path exists) -IC:\Program Files\Java\jdk1.8.0_281\include这是作为编译步骤一部分的包含路径(是的,此路径存在) -IC:\Program Files\Java\jdk1.8.0_281\include

  2. Now when I copy the files necessary to a path that's called ProgramFiles\Java... (No spaces in ProgramFiles) it works fine.现在,当我将必要的文件复制到名为 ProgramFiles\Java...(ProgramFiles 中没有空格)的路径时,它工作正常。

  3. I have a variable retrieved from a .platform file which is utilized for the build, which defines JDK_HOME.我有一个从用于构建的 .platform 文件中检索到的变量,它定义了 JDK_HOME。 I believe this file is utilized for ant/make builds and uses these defined variables in this file.我相信这个文件用于 ant/make 构建并在这个文件中使用这些定义的变量。

Any ideas/paths as to ant or make not liking spaces in the include paths, or anything along those lines?关于蚂蚁的任何想法/路径或不喜欢包含路径中的空格,或者沿着这些线的任何东西? I've looked at many resources online, but very hard to describe the issue.我在网上查看了很多资源,但很难描述这个问题。

Problem clearly is the space in Program Files.问题显然是程序文件中的空间。 Not sure what is so significant about this.不确定这有什么意义。

Hoping the bullet points help in any information needed with anyone who could be familiar with this issue or might have leads.希望这些要点有助于任何可能熟悉此问题或可能有线索的人所需的任何信息。 Thank you.谢谢你。

I'm not sure what ant has to do with this.我不确定蚂蚁与此有什么关系。 But make recipes are just shell scripts (or, if you use Windows cmd.exe instead of a POSIX shell, batch files).但是 make recipes 只是 shell 脚本(或者,如果你使用 Windows cmd.exe 而不是 POSIX shell,批处理文件)。 Just like commands you'd write in a batch file or on the command line directly, you have to add quoting to paths that contain whitespace.就像您在批处理文件中或直接在命令行中编写的命令一样,您必须在包含空格的路径中添加引号。

You don't actually show us either the make recipe or even the complete compile ( cl ) command line that make invokes so we can't give you precise advice, but basically if you cut and paste the command line make invoked into your terminal prompt you'd get exactly the same errors about whitespace.实际上,您并没有向我们展示 make 配方,甚至没有向我们展示 make 调用的完整编译 ( cl ) 命令行,因此我们无法为您提供准确的建议,但基本上如果您将调用的命令行 make 剪切并粘贴到您的终端提示符中你会得到关于空白的完全相同的错误。 Make is not magic: it only runs the commands you tell it to run. Make 并不神奇:它只运行你告诉它运行的命令。

Just like you have to add quotes around paths containing whitespace when you run them from the terminal prompt, so too you need to add quotes to these paths when you run them from a makefile recipe.就像从终端提示符运行它们时必须在包含空格的路径周围添加引号一样,当您从 makefile 配方运行它们时,您也需要在这些路径中添加引号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM