c++fileloggingg++

There are some way to print error log to an external file using g++ C++ compiler? (C++)


i'm trying to compile my code with g++ C++ compiler on Windows and the compiler is returning some errors. Ok, as usual. But it's printing so much errors that the console just goes down to the end and I can't see the first lines of error log. My question is: there are any way to print the error log to an external file so I can read the complete error log?

i.e.

g++ *.h *.cpp > error_log.txt

Solution

  • You need to redirect stderr, but it is shell dependant.

    For example on sh and bash, you can use:

    g++ file 2> error.log
    

    On csh and tcsh it would be:

    ( g++ file ) >& error.log