When I compile my code I get a bunch of errors which I span through the screen and I can see where does the error start. How can I save the output of gcc to a file?
I tried tricks like
gcc > log.txt
or grepping the result but it didn't work. Searching google yields mostly result on explaining how to print to file with c++
GCC outputs errors to the standard error stream not to the standard output stream. You need to redirect standard error, instead of standard output. In bash:
gcc 2> log.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With