Is it possible to instruct GNU c++ compiler to stop after 5 errors found? Can't find this in documentation. Thanks in advance.
I have to ask why you would want to do this. Sometimes the error that exists in the code is not the first or even found in the first five errors. Sometimes it's beyond that and only is recognizable once you scroll down the list. A better method might be to break up your code and place it into smaller libraries if you're bothered by compile times. Or if you're concerned with things scrolling off the screen of a command line, using the '>>' operator to pipe the messages into a file.
There's no way to get it to stop after the first five errors, but -Wfatal-errors
will make it stop after the first one error (not warning, unless you also have -Werror
, which you probably shouldn't). See http://gcc.gnu.org/onlinedocs/gcc-4.4.4/gcc/Warning-Options.html .
This option appears to have been added in GCC 4.0.