Redirecting compiler output
lrtaylor@micron.com
lrtaylor@micron.com
Fri Jan 30 17:46:00 GMT 2004
Try
g77 code.f >& report.txt
or
g77 code.f > report.txt 2>&1
The ">" alone only causes stdout to be redirected to a file. ">&" in some shells causes everything to get redirected. In other shells "2>&1" tells the shell to redirect stderr to the same location as stdout.
Cheers,
Lyle
-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On Behalf Of "Dr. Germund Höjer"
Sent: Friday, January 30, 2004 10:42 AM
To: gcc-help@gcc.gnu.org
Subject: Redirecting compiler output
I cannot get g77 and gcc to redirect compiler messages to a text file.
The line
g77 code.f > report.txt
only creates a file report.txt of zero lenght and any error or warning
messages from the compiler only scroll by on the screen. I get the same
behaviour working in KDE graphic mode and in plain text mode (SuSE Linux
8.1) with various versions of gcc. I am using 3.3.2 now.
And the same happens with gcc 3.2.2 running under MinGW/Windows98 so I
doubt it is an OS problem.
I have not found any clue in the gcc manuals.
Best regards
--
Dr. Germund Hojer
Facultad de Quimica
Universidad Nacional Autonoma de Mexico
Mexico
germund@eros.pquim.unam.mx
More information about the Gcc-help
mailing list