expanded command line too long

♀尐吖头ヾ 提交于 2020-04-10 05:37:33

问题


I face with a problem in linking phase, while working with MSVC9 . It says:

NMAKE : fatal error U1095: expanded command line link.exe . . . too long


回答1:


lol that sucks but we need more information to answer your question. OS for starters, basically, it is saying that the command line to call the linker is bigger than the buffer allows in cmd.exe itself. If i remember correctly there may be a way to make the command shell utilize a bigger buffer on the command line. Or you can possibly change the shell to windows powershell and see if that might work.




回答2:


You can get nmake to write the command line arguments to a file, then use the link option to read the arguments from the file.

Look for "inline files", eg http://msdn.microsoft.com/en-us/library/z440c98k(v=vs.80).aspx

It's a very long time since I did this, but as I recall the usage is something like:

foo.exe : foo1.obj foo2.obj foo3.obj
    link.exe @<<
foo1.obj
foo2.obj foo3.obj
... more arguments, macros etc on one or more lines
<<
    rem other commands go here if you want

Essentially you just have an ordinary nmake command line, but the pair of << markers tell nmake to write the options to a file (and they are replaced by the name of that file), and then @ tells link to read arguments from that file.

The KEEP option (possibly with a specified file name) can be useful for debugging - if link barfs, you can look in the file to see what you actually passed to it.




回答3:


There's not much you can do about fixed command line lengths in your tools. You might like to try and combine your object files into a couple of libraries, and then perform the final link and link the libraries together. This will introduce another step into your Makefile, but will get around the command line too long error.



来源:https://stackoverflow.com/questions/9344489/expanded-command-line-too-long

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!