简体   繁体   English

MinGW/MSYS2 的非本地化版本?

[英]Non-localized version of MinGW/MSYS2?

Is there a way to download MinGW/MSYS2 with gcc, that is not localized?有没有办法用 gcc 下载 MinGW/MSYS2,那是没有本地化的? Localized gcc causes all warnings to become errors in CodeBlocks, if the system language is not English.如果系统语言不是英语,本地化 gcc 会导致所有警告在 CodeBlocks 中变为错误。 This is a bug also reported here:这是一个在这里也报告的错误:

http://forums.codeblocks.org/index.php/topic,9489.msg67120.html http://forums.codeblocks.org/index.php/topic,9489.msg67120.html

The thread also contains a working solution to the problem, but if one could download a non-localized version in the first place, this would be much more convenient.该线程还包含该问题的有效解决方案,但如果可以首先下载非本地化版本,这将更加方便。

I'm pretty sure the following is not the "recommended solution", but I personally gave up on trying to find one.我很确定以下不是“推荐的解决方案”,但我个人放弃了尝试找到一个。 So: My locale is da (Danish) which causes exactly the kind of problem you describe.所以:我的语言环境是da (丹麦语),这正是您描述的那种问题。

My solution?我的解决方案? Simply erase the locale used, causing the system to default to english: ie in my case erase the folder:只需擦除使用的语言环境,导致系统默认为英语:即在我的情况下擦除文件夹:

C:\MinGW\share\locale\da

(In more recent versions the location might be for example msys64\usr\share\locale\sv where in this case sv represents Swedish.) (在最近的版本中,该位置可能是例如msys64\usr\share\locale\sv ,在这种情况下, sv代表瑞典语。)

Why on earth anyone coding in C/C++ would want their tools to output localized error-messages is beyond me...为什么在地球上任何使用C/C++编码的人都希望他们的工具输出本地化的错误消息,这超出了我的理解......

Gcc & G++ in mingw use the environment variable LC_ALL to define the language at top level (if this variable is set), defaulting with the system locale if available, and then english if the locale does not exist. mingw 中的 Gcc 和 G++ 使用环境变量 LC_ALL 来定义顶级语言(如果设置了此变量),如果可用则默认使用系统语言环境,如果语言环境不存在则默认使用英语。

If you want to force those tools to output their messages in english, just add/edit the environment variable LC_ALL with the value en_US.UTF-8如果您想强制这些工具以英语输出它们的消息,只需添加/编辑环境变量LC_ALL ,其值为en_US.UTF-8

Use the commmand使用命令

locale -a

to see a list of enabled locales.查看启用的语言环境列表。 To use USA English, I set below environment variables in my bash's source file要使用美国英语,我在 bash 的源文件中设置了以下环境变量

export LANG=en_US.UTF-8
export LC_CTYPE="en_US.UTF-8"
export LC_NUMERIC="en_US.UTF-8"
export LC_TIME="en_US.UTF-8"
export LC_COLLATE="en_US.UTF-8"
export LC_MONETARY="en_US.UTF-8"
export LC_MESSAGES="en_US.UTF-8"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM