error C2664: 'CWnd::MessageBoxW' : cannot convert parameter 1 from 'const char [12]' to 'LPCTSTR'解决方案
You will have to do one of two things:
- Change your project configuration to use multibyte strings. Press ALT+F7 to open the properties, and navigate to Configuration Properties > General. Switch Character Set to "Use Multi-Byte Character Set".
- Indicate that the string literal, in this case "Hello world!" is of a specific encoding. This can be done through either prefixing it with L, such as L"Hello world!", or surrounding it with the generic _T("Hello world!") macro. The latter will expand to the L prefix if you are compiling for unicode (see #1), and nothing (indicating multi-byte) otherwise.
本文介绍了解决CWnd::MessageBoxW函数中参数类型不匹配的问题,提供了两种解决方案:一是更改项目配置以使用多字节字符集;二是通过特定前缀或宏来指定字符串的编码方式。
988





