Reading through error messages generated by g++ is often a pain because gcc expand names like
std::ostream
in my code into a much longer form like
std::basic_ostream<char, std::char_traits<char> >
in the error messages. Similarly, gcc expands std::string
into std::basic_string<char>
. I don't see any benefit for such expansions, and it only makes it difficult for me to relate the error messages and the error site.
I was wondering if it is possible tell gcc to disable this expansion behavior and use the shorter names with defaulted template parameters as-is?
There is a related question here which seems to be about not showing the long expanded name at all. I am asking here if it is possible to just show the short name as I used in the code. The answer there also didn't solve the problem.
There is no compiler flag to reduce or change the error messages and the related types/templates.
-fdiagnostics-color={auto, always, never}
. See the documentation here.A number of third party tools exist to help you decrypt error messages:
Also as a (very good) alternative, the clang compiler is very, very good at diagnosis and error messages.
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