g++ 花引号在控制台和“问题"中显示不正确列表 [英] g++ curly quotes displayed incorrectly in console and "Problems" list

查看:46
本文介绍了g++ 花引号在控制台和“问题"中显示不正确列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我从 Visual Studio 切换到 Eclipse CDT.我已经把它设置得很漂亮,这样我的 Cygwin 安装中的 G++ 编译器就可以毫不费力地找到并编译我的代码.

不过,有一点小小的不满.每次 G++ 报告警告或错误时,大括号单引号 '' 分别显示为 â€~ ’.这似乎是一个字符编码问题;G++ 或 Cygwin 正在吐出 CDT 或 Eclipse 都不喜欢的字符编码.

Cygwin 显示正确的符号(忽略致命错误):

解决方案

是的,你要么让 Eclipse 显示 UTF-8,要么阻止 Cygwin gcc 使用它.我不知道如何做前者,但你可以通过确保 gcc 使用 LANG=en_US.ISO-8859-1 之类的东西来运行后者.

Recently, I switched from Visual Studio to Eclipse CDT. I've set it up beautifully such that the G++ compiler from my Cygwin installation can locate and compile my code without ado.

There is a minor grievance, however. Each time G++ reports a warning or error, the curly single quotes and appear as ‘ respectively ’. It seems like a character encoding problem; G++ or Cygwin is spitting out a character encoding that either CDT or Eclipse doesn't like.

This is only relevant Google result I could find, but setting the C++ environment variable LANG in Eclipse's preferences to C.UTF-8 or en_US.UTF-8 has no effect.

Running C++ from Cygwin directly reveals the curly single quotes. Is there any way of disabling these altogether? Is there some environment variable I can set or an argument I can pass?

In images

Eclipse shows hieroglyphs in various places:

Cygwin shows the correct symbols (ignore the fatal error):

解决方案

Yep, you either have to get Eclipse to display UTF-8, or to stop Cygwin gcc from using it. I don't know how to do the former, but you can do the latter by making sure that gcc is run with something like LANG=en_US.ISO-8859-1.

这篇关于g++ 花引号在控制台和“问题"中显示不正确列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆