MinGW/MSYS2 的非本地化版本?
有没有办法用 gcc 下载未本地化的 MinGW/MSYS2? 如果系统语言不是英语,本地化 gcc 会导致 CodeBlocks 中的所有警告变成错误。
此错误也在这里报告:
http://forums.codeblocks.org /index.php/topic,9489.msg67120.html
该线程还包含该问题的有效解决方案,但如果可以在第一个中下载非本地化版本地方,这样就方便多了。
Is there a way to download MinGW/MSYS2 with gcc, that is not localized?
Localized gcc causes all warnings to become errors in CodeBlocks, if the system language is not English.
This bug is also reported here:
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
海湾合作委员会mingw 中的 G++ 使用环境变量 LC_ALL 定义顶层语言(如果设置了此变量),如果可用,则默认使用系统语言环境,如果语言环境不存在,则默认为英语。
如果您想强制这些工具以英语输出消息,只需添加/编辑环境变量 LC_ALL ,其值为 en_US.UTF-8
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.
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
我很确定以下不是“推荐的解决方案”,但我个人放弃了寻找一个解决方案。所以:我的语言环境是
da
(丹麦语),这正是您所描述的问题的原因。我的解决方案?
只需删除使用的语言环境,使系统默认为英语:即在我的情况下删除文件夹:(
在较新的版本中,该位置可能是例如
msys64\usr\share\locale\sv
其中在这种情况下,sv
代表瑞典语。)到底为什么任何使用
C/C++
编码的人都希望他们的工具输出本地化的错误消息,这超出了我的理解......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.My solution?
Simply erase the locale used, causing the system to default to english: i.e. in my case erase the folder:
(In more recent versions the location might be for example
msys64\usr\share\locale\sv
where in this casesv
represents Swedish.)Why on earth anyone coding in
C/C++
would want their tools to output localized error-messages is beyond me...使用该命令
查看已启用的区域设置的列表。
为了使用美国英语,我在 bash 的源文件中设置了以下环境变量
Use the commmand
to see a list of enabled locales.
To use USA English, I set below environment variables in my bash's source file
以下内容对我有用。
安装MSYS2后,
我尝试过:
如您所见,
kommandot finns inte
是不是英语。所以我跑了:
1
然后我关闭并重新启动 MSYS2,并尝试再次运行
drivel
:耶! – 现在是英文:
找不到命令
。1
我的解决方案的灵感来自
这个答案。
The following worked for me.
After installing MSYS2,
I tried :
As you can see,
kommandot finns inte
is not English.So I ran :
1
Then I closed and restarted MSYS2, and tried running
drivel
again :Yay! – It's now in English:
command not found
.1
My solution is inspired by
this answer.