'The command line is too long' 在 Windows 命令提示符中链接 .obj 文件时
'The command line is too long' when linking .obj files in Windows command prompt
作为我在 Windows 上构建 maven 的最后一步,它尝试通过链接大约 1500 个目标文件来创建 dll
文件。看起来像这样:
cl.exe foo.dll (around 1500 .obj files) (couple of other statically linked libraries)
构建失败,只有一个语句:
The command line is too long.
已尝试搜索解决方案 here, here and here,但解决方案更具体,而不是更通用的解决方案。谁能建议我能做什么?
我想我得到了问题的答案。
我可以将命令的参数捆绑在一个 .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>
这对我有用。
作为我在 Windows 上构建 maven 的最后一步,它尝试通过链接大约 1500 个目标文件来创建 dll
文件。看起来像这样:
cl.exe foo.dll (around 1500 .obj files) (couple of other statically linked libraries)
构建失败,只有一个语句:
The command line is too long.
已尝试搜索解决方案 here, here and here,但解决方案更具体,而不是更通用的解决方案。谁能建议我能做什么?
我想我得到了问题的答案。
我可以将命令的参数捆绑在一个 .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>
这对我有用。