Directing compile errors to file using g++

TheLonelyPhoenix

Diamond Member
Feb 15, 2004
5,594
1
0
How can I redirect errors from a g++ compile to a file instead of having them all thrown on-screen? I've tried redirecting standard output like this:

g++ myCode.cpp -omyProgram > errors.lst

...but the errors still hit the screen instead.

This is under Slackware Linux, btw.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
g++ probably writes the errors to stderr, so you would need to use 2>filename.