Discussion:
How to capture error output from MinGW
(too old to reply)
Martijn Mulder
20 years ago
Permalink
Hello group,

I work with c++ compilers from various vendors but plan to switch to MinGW
because it adhers very close to the requirements. I work with Windows ME in a
DOS box. I do the editing in vi and invoke the compiler with a batch file.

The error output is sent to file with redirection like this

wcl32.exe myfile.cpp > error.txt

(when I use the Watcom compiler). Then I can study the results and make
improvements. I never have to leave the editor.

Now that I try MinGW, I observe that it is very verbose. Nothing wrong with
that, but I cannot capture the output to a file. All is written to cerr it
seems, and none to cout. Is there an option to redirect the error output to a
file? Or perhaps a Windows hack to achieve the same thing?

I would be glad to learn about it because it is the only thing that keeps me
from the MinGW compiler.
Andy Sinclair
20 years ago
Permalink
...
Typically you would redirect stderr like this (under unix or XP):
wcl32.exe myfile.cpp > error.txt 2>&1

However, DOS and Win9x provide no way of redirecting stderr.

There are two options:
1. Use the 'win95cmd' command shell. Win95cmd is an MS port of the XP
shell which runs under win 98/ME.

You could then use the following:
win95cmd /c wcl32.exe myfile.cpp > error.txt 2>&1

2. Use a specific utility, such as this one:
http://www.teaser.fr/~amajorel/stderr/


Andy
Martijn Mulder
20 years ago
Permalink
...
Thank you Andy for your swift reply. Stderr.exe does exactly what I want it to
do. Further investigations into the MinGW package showed that the problem is
know
and they provide the "redir utility for those who're stuck with braindead
COMMAND/CMD shells on windows32 that cannot redirect standard
error correctly".

redir.exe does the same thing as stderr.exe and more, but it is much bigger.

Now that I have my MinGW system up-and-running, I stumble upon new problems.
Boy, the binaries it produces are BIG! (even after stripping) and it is much
slower than what I'm used to. But I'll need g++ when in doubt if a certain c++
construct is valid or not.

Loading...