g++ error logs

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Adek336

g++ error logs

Post by Adek336 »

Hi all! Is it possible to save all g++ logs, error messages to a file?

Cheers,
Adrian
proxy

Re:g++ error logs

Post by proxy »

uh, well you can tak ethe stderr of any process in *nix and send it to a file like this:

gcc blah.c -o blah 2> err.log

or better yet, if you have a makefile

make 2> err.log
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:g++ error logs

Post by Pype.Clicker »

proxy wrote: uh, well you can tak ethe stderr of any process in *nix and send it to a file like this:

gcc blah.c -o blah 2> err.log

or better yet, if you have a makefile

make 2> err.log
note that this usually works for bash shells, but tends to be misinterpreted by tcsh (doh)
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

Re:g++ error logs

Post by Neo »

what about windows?
Only Human
Adek336

Re:g++ error logs

Post by Adek336 »

Thank you! It works very well ;D I tried with >>, || switches, but duh it didn't work. The 2> switch is much better.

Cheers,
Adrian.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:g++ error logs

Post by Pype.Clicker »

>>file is for append-to file (i.e. the old content is preserved and the new content goes after it)

man bash and man tcsh have plenty of information about this ... just search for "redirect" in it.

btw, i found the TCSH error redirector:

Code: Select all

   command >output.txt >&error.log
Post Reply