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。