Gcc Error Messages Garbled
von GoogleAnmeldenAusgeblendete FelderNach Gruppen oder Nachrichten suchen
Re: garbled messages containing "â" From: Daniel Berlin To: Patrik Jonsson Cc: gcc-help at gcc dot gnu dot org Date: Wed, 19 Jul 2006 19:53:12 -0400 Subject: Re: garbled messages containing "â" References: <44BD850F.7040308@ucolick.org> <44BD88FB.10902@dberlin.org> <44BE6E0E.5090001@ucolick.org> Patrik Jonsson wrote: > Daniel Berlin wrote: >> Patrik Jonsson wrote: >> >>> Hi, >>> >>> My gcc (4.0.2 20051125 (Red Hat 4.0.2-8)) recently started garbling its >>> output by inserting "â" instead of names of https://groups.google.com/d/topic/gnu.gcc.help/MW5jKgAktno routines, arguments, etc. >>> Typical example: >>> >>> blitz-fits.h: In function â: >>> blitz-fits.h:93: error: there are no arguments to â that depend on a >>> template parameter, so a declaration of â must be available >>> blitz-fits.h:93: error: (if you use â, G++ will accept your code, but >>> allowing the use of an https://gcc.gnu.org/ml/gcc-help/2006-07/msg00264.html undeclared name is deprecated) >>> blitz-fits.h:96: error: cannot convert â to â for argument â to â >>> >>> Needless to say, this makes it even harder than normal to figure out >>> what's wrong with the program... ;-) >>> >>> This is on a Fedora Core 4 x86_64 machine. Does anyone have any idea why >>> this is happening and what to do about it? >>> >> does doing "export LANG=C" before running gcc fix it? >> >> > It does. Thanks. Any explanation for what's going on? (The language > isn't even C, it's C++...) > It's not related to the language you are compiling with You have a locale set (probably UTF-8), but whatever you are using to look at the output doesn't support displaying that. > /Patrik > > References: garbled messages containing "â" From: Patrik Jonsson Re: garbled messages containing "â" From: Daniel Berlin Re: garbled messages containing "â" From: Patrik Jonsson Index Nav: [DateIndex] [SubjectIndex] [AuthorIndex] [Thread
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more http://programmers.stackexchange.com/questions/70086/why-are-c-template-error-messages-so-horrific about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Programmers Questions Tags Users Badges Unanswered Ask Question _ Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best gcc error answers are voted up and rise to the top Why are C++ template error messages so horrific? up vote 14 down vote favorite 4 C++ templates are notorious for generating long, unreadable error messages. I have a general idea of why template error messages in C++ are so bad. Essentially, the problem is that the error isn't triggered until the compiler encounters syntax that is not supported by gcc error messages a certain type in a template. For example: template void dosomething(T& x) { x += 5; } If T doesn't support the += operator, the compiler will generate an error message. And if this happens deep within a library somewhere, the error message might be thousands of lines long. But C++ templates are essentially just a mechanism for compile-time duck typing. A C++ template error is conceptually very similar to a runtime type error that might occur in a dynamic language like Python. For example, consider the following Python code: def dosomething(x): x.foo() Here, if x doesn't have a foo() method, the Python interpreter throws an exception, and displays a stack trace along with a pretty clear error message indicating the problem. Even if the error isn't triggered until the interpreter is deep inside some library function, the runtime-error message still isn't anywhere near as bad as the unreadable vomit spewed by a typical C++ compiler. So why can't a C++ compiler be more clear about what went wrong? Why do some C++ template error messages literally cause my console window to scroll for over 5 seconds? c++ python templates error-messages share|improve this question edited Apr 21 '11 a