[an error occurred while processing this directive] Node:Redirect, Next:, Previous:General trouble, Up:Trouble

6.15 I cannot keep up with the error messages

Q: I want to read all the error messages that GCC throws at me, but there are so many that I can't keep up. How can I redirect them to a file?

Q: When I add -v to the GCC command line, how can I put all the voluminous output into a file, so I don't miss anything when reporting a problem?

Q: I have this nifty graphics program which bombs from time to time, but the registers and traceback info are hidden by the graphics display. How can I see it?

A: Error messages are usually written to stderr, and stock COMMAND.COM cannot redirect it. There are several alternatives to do that:

  1. You can use a shell smarter then COMMAND.COM, such as 4DOS or bash, which knows how to redirect standard error stream to a file. 4DOS is shareware and can be found on SimTel.NET, while bash is available from the v2gnu directory of DJGPP archives on SimTel.NET.
  2. You can also run your program under any one of the programs which save all screen output of programs they spawn in a file. I suggest using a program called SCRIPT, which is similar to its Unix namesake. It has an advantage of saving everything which goes to screen and showing it on the screen at the same time. You can find SCRIPT on SimTel.NET.
  3. Or you can use the REDIR program which comes with DJGPP. It also redirects standard output and/or standard error to a file, but you don't get a chance to look at the output while the program runs. Here's how to run GCC with REDIR:
      redir -o gcc.log -eo gcc -v ...
    

    (put the rest of the GCC command line instead of the dots). The messages printed by GCC will be written to the file gcc.log.

Windows/NT has its own program named redir.exe, so make sure the DJGPP's bin subdirectory is listed in the PATH variable before the NT directories.


[an error occurred while processing this directive]