Capturing Error Output on DOS

Sisyphus kalinabears@iinet.net.au
Sat Oct 25 13:56:00 GMT 2003


Martijn Mulder wrote:
> Hi group,
>  
> I have a real stupid problem but it is getting to me. My 
> 'Hello World' program produces 6 pages of errors and 
> warnings on compilation, and that is fine with me, but
> I am not able to capture the output to a file.
>  
> I work from a DOS box under WindowsME.
>  
> Normally, I intercept error output like this:
> C:\MinGW\bin\gcc.exe HelloWorld.cpp > error.txt
> but with gcc it races over the screen and cannot
> be captured. No 'tee' utility under DOS.
>  
> This is probably of-topic since it is DOS related but
> in this mailing group others must have experienced
> the same problem. If anyone can help? Thanks.
>  
> -X

Try:
C:\MinGW\bin\gcc.exe HelloWorld.cpp > error.txt 2>&1

That might not work either on WinME, in which case you would be best to 
obtain a shell that does understand '2>&1' and run your programs in 
that. (MSYS is one such shell - Google for 'MSYS' should do the trick.)

Alternatively, you might find the errors disappear altogether if you run:
C:\MinGW\bin\g++.exe HelloWorld.cpp

Note also that you shouldn't have to specify the '.exe' in the command, 
and if you set your path environment variable appropriately (which 
should get taken care of during configuration/installation wrt the MSYS 
shell) you'll be able to simply run:
gcc Hello.c
or
g++ Hello.cpp

Hth.

Cheers,
Rob


-- 
Any emails containing attachments will be deleted from my ISP's mail 
server before I even get to see them. If you wish to email me an 
attachment, please provide advance warning so that I can make the 
necessary arrangements.



More information about the Gcc-help mailing list