Quote of the Day:
When something can be read without effort, great effort has gone into its writing.
--Enrique Jardiel Poncela
为了简化,例程只跟主题相关:
#include<iostream>
using namespace std;
int main(int argc, char** argv)
{
cout << "English" << endl;
wcout << L"中文" << endl;
return0;
}
1) build log:
“converting to execution character set: Illegal byte sequence”
-finput-charset=
charset
Set the input character set, used for translation from the character set of the input file to the source character set used by GCC. If the locale does not specify, or GCC cannot get this information from the locale, the default is UTF-8. This can be overridden by either the locale or this command line option. Currently the command line option takes precedence if there's a conflict. charset can be any encoding supported by the system's iconv
library routine.
根据上面的说法,在没有指定locale或GCC不能获取现场信息时,会默认编码为UTF-8。同时,设置也可能会被
-finput-charset=
charset 选项指定的设置覆盖 -- 优先采用这个选项。
加-finput-charset=GBK编译选项,使GCC能够正确解码源文件。
2) build log:
“error: `std::wcout' has not been declared”
查了半天,结果还是不尽人意,据说是MingW gcc 暂不支持 wostream。