Selecting message language in gcc and g++

前端 未结 3 1576
面向向阳花
面向向阳花 2020-12-14 15:58

I use gcc/g++ on Linux and since my install is in Spanish (my native language), gcc prints warnings and errors in Spanish. I would rat

相关标签:
3条回答
  • 2020-12-14 16:05

    To change the gcc translations to English, to must set the environment variable LANG to English:

    $ export LANG=en

    add it to your .profile file and it will always be in English

    0 讨论(0)
  • 2020-12-14 16:06

    Try to change the LANG environment variable: http://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Environment-Variables.html#Environment-Variables.

    0 讨论(0)
  • 2020-12-14 16:19

    The end of the GCC manpage contains an overview of its locale environment variables:

    • LANG
    • LC_CTYPE
    • LC_MESSAGES
    • LC_ALL

    These environment variables control the way that GCC uses localization information that allow GCC to work with different national conventions. GCC inspects the locale categories LC_CTYPE and LC_MESSAGES if it has been configured to do so. These locale categories can be set to any value supported by your installation. A typical value is en_GB.UTF-8 for English in the United Kingdom encoded in UTF-8.

    The LC_CTYPE environment variable specifies character classification. GCC uses it to determine the character boundaries in a string; this is needed for some multibyte encodings that contain quote and escape characters that would otherwise be interpreted as a string end or escape.

    The LC_MESSAGES environment variable specifies the language to use in diagnostic messages.

    If the LC_ALL environment variable is set, it overrides the value of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES default to the value of the LANG environment variable. If none of these variables are set, GCC defaults to traditional C English behavior.

    I do this:

    LC_MESSAGES=C gcc-command-here
    
    0 讨论(0)
提交回复
热议问题