0

我正在通过 C++Builder XE5 的命令行工具构建一个项目,但是目标文件太多,所以输出为:

MAKE Version 5.4  Copyright (c) 1987, 2010 Embarcadero Technologies, Inc.
    ilink64 ...........

Fatal: Command arguments too long

我该如何解决这个问题?

(元注释:我即将回答我自己的问题,但我花了很长时间才弄清楚这一点,因为官方文档不是很有启发性,所以我发布了这个 QA,以防它帮助其他有同样问题的人)。

4

1 回答 1

0

Example syntax for creating and using a response file in the makefile:

myproject.dll: $(MANYOBJECTS)
    ilink64 $(LINKER_FLAGS) @&&.
$(MANYOBJECTS), myproject.dll, , import64 cw64mt
.

The key ideas are:

  • the character immediately following the && is the character to be used as delimiter, other delimiters besides . are possible
  • the text between the two .'s is expanded and placed in a temporary file
  • The closing delimiter must be the first character on its line
  • the temporary filename takes the place of the &&.....
  • Anything after the opening delimiter on the same line is ignored
  • The @ means that ilink64 will treat the contents of the temporary file as a response file, as opposed to treating it as an object file
  • Anything after the response file is actually ignored by ilink64 despite correctly appearing in the command output (don't know why; but this means you have to make the response file contain the entire remainder of the command).

The command generated by this example was:

MAKE Version 5.4  Copyright (c) 1987, 2010 Embarcadero Technologies, Inc.
    ilink64 -q -aa -Tpd -x -Gn c0x64 @MAKE0000.@@@

(note: my linker flags may be incorrect, this is just a demonstration of how the response file works).

于 2014-06-12T01:09:03.133 回答