MessageBoxW 无法转换 [英] MessageBoxW cannot convert
问题描述
我在 Visual Studio 2012 中使用 wxWidgets 2.9.4,我不断收到以下两条错误消息:
I am using wxWidgets 2.9.4 in Visual Studio 2012 and I keep getting these two error messages:
错误 1 错误 C2664:MessageBoxW":无法将参数 2 从const char *"转换为LPCWSTR"
Error 1 error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char *' to 'LPCWSTR'
IntelliSense:const char *"类型的参数与LPCWSTR"类型的参数不兼容
IntelliSense: argument of type "const char *" is incompatible with parameter of type "LPCWSTR"
我的代码是:
#ifdef _WIN32
std::string msg;
StringFromFormatV(&msg, format, args);
retval = IDYES == MessageBox(0, msg.c_str(), "ERROR! Continue?", MB_ICONQUESTION | MB_YESNO);
推荐答案
您在编译项目时默认使用多字节字符.您可以在项目的属性中更改它,也可以使用 msg.wc_str()
,甚至强制使用 MessageBoxA
而不是使用宏 MessageBox代码>.
You are compiling your project using multi-byte characters as default. You can change that in your project's properties, or you can use msg.wc_str()
, or even enforce the use of MessageBoxA
instead of using the macro MessageBox
.
这篇关于MessageBoxW 无法转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!