Re: weird characters in compiler warnings output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"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.

Brian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux