Quote of the Day:
When something can be read without effort, great effort has gone into its writing.
--Enrique Jardiel Poncela
為了簡(jiǎn)化,例程只跟主題相關(guān):
#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.
根據(jù)上面的說(shuō)法,在沒(méi)有指定locale或GCC不能獲取現(xiàn)場(chǎng)信息時(shí),會(huì)默認(rèn)編碼為UTF-8。同時(shí),設(shè)置也可能會(huì)被
-finput-charset=charset 選項(xiàng)指定的設(shè)置覆蓋 -- 優(yōu)先采用這個(gè)選項(xiàng)。
加-finput-charset=GBK編譯選項(xiàng),使GCC能夠正確解碼源文件。
2) build log:
“error: `std::wcout' has not been declared”
查了半天,結(jié)果還是不盡人意,據(jù)說(shuō)是MingW gcc 暫不支持 wostream。