Menu

Linker trouble: max cmd line length reached

2003-03-27
2012-09-26
  • Tobias Jakobi

    Tobias Jakobi - 2003-03-27

    Hi there,
    after using devcpp for a long time I'm in big trouble now. It's how the subject tells you, when linking my object-files the maximum commandline length is reached and therefore the command isn't recognized by the command line interpreter.
    It simply says: "Bad command or file name"

    My question is: is there a way around this limit? when trying to execute the makefile with cygnus it works flawless. POSIX handles long command line far better than the shitty w32api.
    maybe add an option to exec the makefile through a differnet system like cyg32 or msys? or try to avoid the problem with merging several object files into a static lib and then linking all created static libs together?

    While searching the web I also found the possibility to use something called "linker command files". I don't know if mingw32 supports this feature but it would be the best way to get around the limit.

    But maybe its only my command line interpreter that can't handle long inputs. I'm using win98 second edition. I know that win2k has a different cmd line interpreter so maybe its now the right time to switch operating systems. anyone with information about this problem on w2k systems?

    cya
    liquid

     
    • Curtis Sutter

      Curtis Sutter - 2003-03-27

      I have heard that editing you Makefile for *.o instead of main.o junk.o ... will work, but then you have to call the linker yourself, or Dev will re-write the file...  Maybe there should be a link-only cmd?

      Curtis

       
    • Tobias Jakobi

      Tobias Jakobi - 2003-03-28

      So here we are again...

      Some nice guy from the 3dcenter.de board posted a solution to the problem. and its in fact a problem with the way dev-c++ executes the commands to compile and link.
      using the win32api call CreateProcess would be the best idea, because the function handles arbitrary long command sequences.

      but as long the use of CreateProcess isn't implemented we can still do something against the limitation of the command line interpreter, that is responsible for handling the compile and linker commands.
      the trick is to simply NOT use it at all, don't use the standard cmd line interpreter like command.com or cmd.exe that ships with windows.
      one alternative would be installing MSYS from the mingw32 project (its small and does its job very well) or the huge cygnus win package. I chose to use msys for handling input. and as far as I can see it works rather good. no problems at all.

      how to do it:
      1) download MSYS (www.mingw.org) and install
      2) configure after install (don't know if thats critical)
      3) edit config.sys (add line that says: SHELL=c:\path_to_msys_dir\bin\sh.exe )
      3) edit autoexec.bat (add line that says: set COMSPEC=c:\path_to_msys_dir\bin\sh.exe )
      4) reboot
      5) try to compile a huge project with many object files

      Maybe someone of the devs should test this and add the explanation to the documentation.

      cya
      liquid

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.