Search code examples
linuxgccg++cygwin

Does GCC support command files


MSVC compilers support command files which are used to pass command line options. This is primarily due to the restriction on the size of the command line parameters that can be passed to the CreateProcess call.

This is less of an issue on Linux systems but when executing cygwin ports of Unix applications, such as gcc, the same limits apply.

Therefore, does anyone know if gcc/g++ also support some type of command file?


Solution

  • Sure!

    @file
               Read command-line options from file.  The options read are inserted
               in place of the original @file option.  If file does not exist, or
               cannot be read, then the option will be treated literally, and not
               removed.
    
               Options in file are separated by whitespace.  A whitespace
               character may be included in an option by surrounding the entire
               option in either single or double quotes.  Any character (including
               a backslash) may be included by prefixing the character to be
               included with a backslash.  The file may itself contain additional
               @file options; any such options will be processed recursively.
    

    You can also jury-rig this type of thing with xargs, if your platform has it.