This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: weird characters in compiler warnings output

"Abarbanel, David (US SSA)" wrote:
> I am running gcc v4.1.1 on linux 2.4 and was wondering why I am seeing weird characters around certain identifiers when warnings are printed.  Is this normal? See the example below:
> test.cpp: In function âint main()â:
> test.cpp:7: error: âcoutâ was not declared in this scope
> test.cpp:7: error: âendlâ was not declared in this scope

This means that you have a discrepancy between your locale settings and
the terminal you are using.  For example, many distros set the locale
environment variables (LC_*) in the .bashrc type startup files to
something like en_US.UTF-8 by default.  This tells programs to use US
English messages (and sorting collations, etc.) with UTF-8 encoding. 
But if your terminal does not support the UTF-8 you will get garbage
characters when the program tries to use any code points outside of the
ascii range, in this case opening and closing quotes.

The solution is to set your locale to match the capabilities of the
terminal that you are using.  If you can't figure this out you can
always use the default POSIX/C locale (e.g. "export LC_ALL=C") which
will only use standard ascii characters.

This has nothing to do with the functionality of gcc or the code it
generates, only messages that it prints.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]