如何在VC 10编译器上强制使用UNICODE / wchar [英] How to enforce to use UNICODE/wchar on VC 10 compiler
问题描述
我记得当我将/ DUNICODE / D_UNICODE标志传递给过去一年的编译器时,如果我混合使用宽字符和ANSI之类的话,它会抛出错误吗?
I remember when I pass /DUNICODE /D_UNICODE flags to compiler past year
这个
int wmain(){
wcout<<"hello world"
}
现在我很困惑,编译器不再抱怨/关心了,因为
now I'm confused the compiler doesnt complains/cares anymore
请帮助导致此问题的原因
Please help what caused this problem
我使用的是控制台CL编译器。上面的程序成功构建没有错误。
I use console CL compiler. the program above build successfully without errors.
编译器没有说什么。它的疯狂b
the compiler doesnt says anything. its crazy
:(
推荐答案
在10/14/2018 9:54 AM,bobsadino写道:
On 10/14/2018 9:54 AM, bobsadino wrote:
我记得当我将/ DUNICODE / D_UNICODE标志传递给过去一年的编译器时,如果我混合使用宽字符和ANSI这样的话,它会抛出错误
I remember when I pass /DUNICODE /D_UNICODE flags to compiler past year
it throws error if I mixed wide char and ANSI like this
int wmain(){
wcout<<"hello world"
}
现在我是困惑编译器不再抱怨/关心
now I'm confused the compiler doesnt complains/cares anymore
wcout<<""hello world" 是,并且一直是有效代码。它使用一个运算符<<()重载取出void *,并打印(窄)字符串文字所在的地址。我不知道任何会导致此行失败的标志,选项或宏
编译。
wcout<<"hello world" is, and has always been, valid code. It uses an operator<<() overload taking void*, and prints the address at which the (narrow) string literal is located. I don't know of any flags, options or macros that would make this line fail to compile.
这篇关于如何在VC 10编译器上强制使用UNICODE / wchar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!