<p>I'm really beginning to understand what people mean when they say that C++'s error messages are pretty terrible in regards to templates.  I've seen horrendously long errors for things as simple as a function not matching its prototype.</p>

<p>Are there any tricks to deciphering these errors?</p>

<p>EDIT:  I'm using both gcc and MSVC.  They both seem to be pretty terrible.</p>

[{'answer_id': 47983, 'author': 'nsanders', 'author_id': 1244, 'author_profile': 'https://Stackoverflow.com/users/1244', 'pm_score': 5, 'selected': True, 'text': '<p>You can try the following tool to make things more sane:</p>\n\n<p><a href="http://www.bdsoft.com/tools/stlfilt.html" rel="noreferrer">http://www.bdsoft.com/tools/stlfilt.html</a></p>\n'}, {'answer_id': 47985, 'author': 'Leon Timmermans', 'author_id': 4727, 'author_profile': 'https://Stackoverflow.com/users/4727', 'pm_score': 2, 'selected': False, 'text': '<p>Some compilers give better messages than others. What compiler are you using? Having said that, they are all pretty bad. C++0X will fix most of this problem (see <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Concepts" rel="nofollow noreferrer">concepts</a>), but the standard won\'t be released until 2009, and broad support will probably be even later than that :-(</p>\n'}, {'answer_id': 48055, 'author': 'Bernard', 'author_id': 61, 'author_profile': 'https://Stackoverflow.com/users/61', 'pm_score': 4, 'selected': False, 'text': "<p>I sure as hell can't. Small errors explode into pages and pages of unreadable junk. Usually early in the morning, before coffee. :(</p>\n\n<p>My only advice is to take a deep breath, start at the top and try and parse the important pieces of information. (I know, easier said than done, right?).  </p>\n"}, {'answer_id': 48120, 'author': 'Andy', 'author_id': 3857, 'author_profile': 'https://Stackoverflow.com/users/3857', 'pm_score': 2, 'selected': False, 'text': '<p>At least in Visual Studio, there is more information given in the Output Build window rather than the Error List. I\'ve had a template error in the Error List state, "Cannot convert Foo&lt;int&gt; to Foo&lt;int&gt;". There were some lines following the actual error in the Output window that helped me to decipher what the actual problem was.</p>\n'}, {'answer_id': 48263, 'author': 'Motti', 'author_id': 3848, 'author_profile': 'https://Stackoverflow.com/users/3848', 'pm_score': 3, 'selected': False, 'text': '<p>As @<a href="https://stackoverflow.com/questions/47980/deciphering-c-template-error-messages#47983">nsanders</a> said <a href="http://www.bdsoft.com/tools/stlfilt.html" rel="nofollow noreferrer">STLFilt</a> is a good solution. A home grown STLFilt (when you don\'t want to go to the trouble of installing Perl) is to copy the error message in an editor and start replacing parts of the error until it becomes (more) manageable.</p>\n\n<p>e.g.</p>\n\n<pre><code>s/std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt;&gt;/string/g \n</code></pre>\n\n<p>In less geeky terms this means:</p>\n\n<p>Replace:</p>\n\n<pre><code>std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt;&gt;\n</code></pre>\n\n<p>With:</p>\n\n<pre><code>string\n</code></pre>\n'}, {'answer_id': 61526908, 'author': 'tom', 'author_id': 10184846, 'author_profile': 'https://Stackoverflow.com/users/10184846', 'pm_score': 2, 'selected': False, 'text': '<p>Even though its an old post, this may be helpful for other people stumbling upon this post.</p>\n\n<p>I had exactly the same issue, in my case the errors could not even be printed to screen anymore as they were too long. So I dumped them into a text file and tried some basic search using a text editor rather than grep\'ing through the file, some of which could be as large as 20 MB (not bad for just <em>errors</em>). Most errors would be duplicated, as I compiled in parallel, so that was another huge problem.</p>\n\n<p>As I was getting tired with that approach (and also it was not very productive), I developed a small helper program which I could chain in directly into my compiler toolchain, so that any output generated by the compiler could be formatted based on some rules defined in a json file. The program can be found here: <a href="https://github.com/tomrobin-teschner/dotify" rel="nofollow noreferrer">https://github.com/tomrobin-teschner/dotify</a></p>\n\n<p>There are three basic functionalities:</p>\n\n<ul>\n<li>Don\'t print current output (line) from compiler if it contains a certain string</li>\n<li>Only print a certain line if it contains a keyword (which can be colorised)</li>\n<li>If there is a template involved, remove the content between the &lt;> brackets and replace them by dots. So for example, <code>MyClass&lt;std::vector&lt;double&gt;, std::array&lt;double, 3&gt;&gt;</code> would be simply replaced by <code>MyClass&lt;...&gt;</code>.</li>\n</ul>\n\n<p>The full error message is still stored inside a log file (and can be later used if more detailed information are required), the parser only works on the output which is printed to the console.</p>\n\n<p>The command to invoke the parser is</p>\n\n<p><code>/path/to/program | tee log | /path/to/parser -f /path/to/inputFile.json</code></p>\n\n<p><code>/path/to/program</code> is the program to execute (and from which the output should be formatted)\n<code>/path/to/parser -f /path/to/inputFile.json</code>, location of the parser, the -f flags specifies the input file (in json format), which, for a very simple case could look like this:</p>\n\n<pre><code>{\n  "ignoreCompleteLineIfItContainsSubstring" : [\n    "should be suppressed"\n  ],\n  "ignoreContentBetweenDelimiter" : [\n    {\n      "startingDelimiter" : "&lt;",\n      "endingDelimiter" : "&gt;",\n      "replaceContentBy" : "..."\n    }\n  ],\n  "styleLineContainingKeywords" : [\n    {\n      "keyword" : "error",\n      "removeDuplicates" : true,\n      "applyStyle" : "onKeyword",\n      "color" : "red",\n      "style" : "bold"\n    }\n  ]\n}\n</code></pre>\n\n<p>A full list of options and explanations can be found on the project site (<a href="https://github.com/tomrobin-teschner/dotify" rel="nofollow noreferrer">https://github.com/tomrobin-teschner/dotify</a>)</p>\n'}]
['https://Stackoverflow.com/questions/47980', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2147/']