Article View: alt.linux
Article #327Re: howto move the errors from gcc to a file?
From: Jim Cochrane
Date: Fri, 25 May 2001 17:59
Date: Fri, 25 May 2001 17:59
37 lines
2341 bytes
2341 bytes
In article <3b0d0a50.19718301@news.adelaide.on.net>,
David. E. Goble <goble@gtech> wrote:
>Hi all;
>
>I am just beginning to try programming in linux (redhat).
>
>My problem is when I use gcc ...etc it produces a scolling list of
>errors. How can I move or pipe the errors to a file. ie something like
>
> gcc -o hello.c > error.txt?
^^^^^^^
[You might realize this, but this will overwrite hello.c as the executable.
You need "gcc -o hello hello.c".]
To expand a bit on what others posted, you can direct just stderr to a
file (stdout will still go to the console):
gcc -o hello hello.c 2>/tmp/errors # put in /tmp so you don't need to cleanup
Send stdout and stderr to separate files:
gcc -o hello hello.c >/tmp/gccout 2>/tmp/errors
Send stdout and stderr to the same file:
gcc -o hello hello.c >/tmp/errors 2>&1
[You might want to check out
http://sunsite.dk/linux-newbie/FAQ2.htm#io_redirection
for a short tutorial on output redirection.]
This is all with bash (or sh or ksh), of course - with csh-based shells the
syntax is different.
--
Jim Cochrane
jtc@dimensional.com
Technical Details
Message-ID:
<9em6h8$bn4@flatland.dimensional.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.frii.net!pulsar.dimensional.com!dimensional.com!wormhole.dimensional.com!flatland.dimensional.com!not-for-mailReferences:
<3b0d0a50.19718301@news.adelaide.on.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10c696,4d862f9db31ad355 X-Google-Attributes: gid10c696,public X-Google-Thread: f9b51,4d862f9db31ad355 X-Google-Attributes: gidf9b51,public X-Google-Thread: 100c5f,4d862f9db31ad355 X-Google-Attributes: gid100c5f,public X-Google-Thread: 102983,4d862f9db31ad355 X-Google-Attributes: gid102983,public X-Google-ArrivalTime: 2001-05-25 10:59:08 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.frii.net!pulsar.dimensional.com!dimensional.com!wormhole.dimensional.com!flatland.dimensional.com!not-for-mail From: jtc@dimensional.com (Jim Cochrane) Newsgroups: alt.linux,aus.computers.linux,comp.os.linux.development.apps,comp.os.linux.setup Subject: Re: howto move the errors from gcc to a file? Organization: Dimensional Communications Lines: 37 Message-ID: <9em6h8$bn4@flatland.dimensional.com> References: <3b0d0a50.19718301@news.adelaide.on.net> Date: 25 May 2001 11:59:04 -0600 NNTP-Posting-Host: 206.124.0.24 X-Trace: wormhole.dimensional.com 990813547 206.124.0.24 (Fri, 25 May 2001 11:59:07 MDT) NNTP-Posting-Date: Fri, 25 May 2001 11:59:07 MDT