Have you ever looked at your terminal while compiling and went "damn, I wish I could read this all properly", especially when you get a bunch of errors?
Well, no worries! There's a very easy way to do that. All you need to do is redirect the output with some simple commands.
The commands are thus:
make -j 1> log.txt
make -j 2> log.txt
make -j &> log.txt
Now, here's a small explainer for each part of the command.
make -j
I hope you already know what this command does.
1>, 2>, and &>
These are redirect commands. Put simply, they redirect the output of the command before it to the destination in it's right.
> is the actual symbol that redirects to the file, and what you put before it is what dictates what gets redirected.
1 refers to stdout, short for standard output. Anything from 1 will be any "normal" process the compiler spits out.
2 refers to the stderr, short for standard error. Anything from 2 will be any warning and the compiler spits out.
When you compile normally without any redirection commands, the output you see on the terminal is both the stdout and stderr. Hence, well, being called standard.
& normally means pushing a command in the background. For example, make -j & will mean nothing gets printed in the terminal until it's done. However, with the redirection command, what happens is both stdout and stderr both get redirected into log.txt
log.txt
This part of the command simply names which file you want the output being redirected to. If the file doesn't exist yet, it is created with then. Anything inside of it will also be overwritten with the output. You can put any filepath you wish here. For example, if you want the file to appear in your Desktop, you can put /mnt/c/Users/<name>/Desktop/log.txt, assuming you use WSL.
If you want to do this method, I also recommend adding log.txt to your .gitignore so you don't accidentally track the file.
That's all! Hope this helps <3