How do I disable g++ displaying notes for errors?
When compiling, errors are often accompanied by a lengthy trace (cyan). Is there a g++ flag to disable this, only showing the error itself?
You can use an old and no longer supported tool like STLFilt.
You can switch to Clang, or use it to report errors only and perform your final compilation in GNU g++.
You can become more familiar with STL which will make deciphering easier.
A good understanding of the STL and how to use it will help you avoid lots of errors in the first place. Secondly, often error messages refer to functions in the STL source - if you have a rough idea how the STL is implemented, this can be extremely helpful in deciphering what the error message is going on about. The newest versions of the g++ compiler sometimes improve the output, making it more helpful and less verbose.
Not exactly what you want but it can shorten the output:
Use the -fmax-errors flag or -Wfatal-errors option:
-fmax-errors=n
Limits the maximum number of error messages to n, at which point GCC bails out rather than attempting to continue processing the source code. If n is 0 (the default), there is no limit on the number of error messages produced. If -Wfatal-errors is also specified, then -Wfatal-errors takes precedence over this option.
-Wfatal-errors
This option causes the compiler to abort compilation on the first error occurred rather than trying to keep going and printing further error messages.
The compiler will not do this for you, but (so far...) the compiler developers are following a longstanding (30+ year) convention adapted from other compilers which gives the essential information on the first line, using error:
or warning:
to mark the warning. If you grep stderr for those, you will see the minimal warning/error information.
grep is a good starting point (and "grep -n" output is useful by itself). These messages follow a pattern of filename, line number, message which is common to several tools. I used that in vi-like-emacs here.
Fairly recently (in 2014) gcc/g++ started adding a "calling-stack" to the messages, which gives the extra information. That relies upon a change to the preprocessor to track the line-numbers which can be turned off with a -P
option (noted here), but that appears to be incompletely integrated in a form which would suppress the calling-stack.
Using clang would not help much with this; it can be very verbose as well. gcc/g++ development has added a lot of messages as noted here.