The first is to use VC + + tools to learn C + +, learn more on the VC block I see things curious, always want to contact some development environment, today time to explore the Codeblocks this open-source IDE use method, the configuration of the compiler is the MinGW gcc compiler, GCC compiled multibyte set of characters is not a problem, but encountered wide characters, found that the compilation does not pass through the multi-party lookup, found that GCC support for wide-character rules and I used the CL compiler has some differences, the specific usage is as follows:
GNU/C + + compiler GCC can also correctly support wchar_t characters and strings, but the source code must be saved in a format that meets the following criteria:
One: The source code file must be saved code UTF-8;
Two: UTF-8 encoded format source code file, can not have BOM logo header.
GCC correctly supports wchar_t characters and strings only if the source code file conforms to the two criteria above. If the above two conditions are not met, it is possible to compile an error, possibly producing an incorrect wchar_t character and string.
GCC under the Windows platform, wchar_t is a 16-bit type, and under the Linux platform, wchar_t is a 32-bit type.
In addition, GCC provides the following parameter switches to support other text-encoded source files:
A)-finput-charset=charset
GCC by default, always assume that the source code is UTF-8, if it is other encoded source code files, the source is used in the wchar_t type, you can use the-finput-charset= CharSet this parameter to implement. For example, the source code that is usually encoded with GBK can be used if the parameter:-FINPUT-CHARSET=GBK
b)-fwide-exec-charset=charset
By default, GCC under the Windows platform, each character of a wide string constant is a 16-bit UTF-16 type, and under the Linux platform, each character of a wide string constant is a 32-bit UTF-32 type, using this parameter, you can change the type of the wide string constant. For example, in x86 's Machine environment, the Linux operating system, for example L "kanji" after compiling the string saved as UTF-16, you can use-fwide-exec-charset=utf-16le
Note: My later resolution process, is directly with Notepad re-open the Save as UTF-8 format, compiled through, but this feels good trouble, I have to try another method, finally ignore the source code file save format, just set-FINPUT-CHARSET=GBK in the compilation options, This is also possible (the character encoding on Windows seems to always be GBK).
1 TCHAR szmsgtext[] = TEXT ("Hello everyone!"); 2 TCHAR szmsgtitle[] = TEXT ("Hint!");
Http://www.cnblogs.com/guobbs/p/3654317.html
The GCC compiler's recognition of wide characters