My codes are as simple as these:
#include <iostream>
using namespace std;
//Some codes here...
bool somefunction(){
cout<<"单元格";
return false;
}
and this is what I got:
error C2143: syntax error: missing ';' before 'return'; error C2001: newline is constant;
Moreover, if i change "单元格" into an English version like "cell", it works perfectly;
The compiler errors indicate that your compiler doesn't support Unicode characters in source code. You'll have to escape them, use wide-character constants, and wcout:
wcout << L"\x5355\x5143\x683c";
If you need to output characters in a specific encoding (e.g. gb2312), use that encoding in the string literal:
cout << "\xb5\xa5\xd4\xaa\xb8\xf1"; // string encoded with GB2312
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With