【问题标题】:'The command line is too long' when linking .obj files in Windows command prompt在 Windows 命令提示符中链接 .obj 文件时出现“命令行太长”
【发布时间】:2015-06-12 14:30:28
【问题描述】:

作为我在 Windows 上构建 maven 的最后一步,它尝试通过链接大约 1500 个目标文件来创建一个dll 文件。看起来像这样:

cl.exe foo.dll (around 1500 .obj files) (couple of other statically linked libraries)

构建失败,只有一条语句: The command line is too long.

已尝试搜索解决方案 hereherehere,但这些解决方案更具上下文特定性,而不是更通用的解决方案。谁能建议我能做什么?

【问题讨论】:

  • 重组你的程序。如果您将 1500 个目标文件中的一些打包到库中会更好...

标签: windows maven dll cmd linker


【解决方案1】:

我想我得到了问题的答案。 我可以将命令的参数捆绑在一个.rsp 文件中,并在我的命令提示符处使用可执行文件在其路径前加上“@”后启动它。 所以,对于这个命令:

cl.exe foo.dll (around 1500 .obj files) (couple of other statically linked libraries)

我把这个

foo.dll (around 1500 .obj files) (couple of other statically linked libraries)

在文件中说makeDLL.txt。通过更改其扩展名 (makeDLL.rsp) 将其更改为 .rsp 文件并启动此命令:

cl.exe @<full-path of makeDLL.rsp>

这对我有用。

【讨论】:

  • 感谢这个,它让我很开心;)。还提到了here。也与此issue 有关
猜你喜欢
  • 2020-08-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-12-08
  • 1970-01-01
  • 2014-04-05
  • 1970-01-01
相关资源
最近更新 更多