Codeblocks + mingw + wcout + Chinese note

Source: Internet
Author: User

I started to study c ++ well. I saw the second chapter about wchar_t wide byte and wcout. I made a try,

# Include <iostream>
Int main ()
{
STD: wcout. imbue (STD: locale ("CHS "));
STD: wcout <L "Unicode, hello! "<STD: Endl;
Return 0;
}

Declaration, the editor used at this time is C-free and the compiler is mingw, but there are two errors. What errors have you forgotten, it is probably because "wcout is not a member of STD" "illegal byte sequence" is hard to remember. The encoding and wcout errors are caused. I checked from the Internet for half a day that the original mingw does not support wcout and wcin, so I used stlport to start a series of configurations. Since C-free has few materials, I used codeblocks as the editor.

Even if it is there, msys cannot find it. Install and configure mingw and msys and stlport is not much said, in the http://hi.baidu.com/jasonlyy/blog/item/1c9caaee9b2b702a62d09fee.html is very detailed.

the output is correct, but it is strange that even if it was configured yesterday, the error "illegal byte sequence" still exists, and the other option is configured in the compiler and debugger options- finput-charset = GBK. However, if this configuration is removed today, it can run correctly. codeblocks is still not familiar with codeblocks...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.