VC2010 messagebox 报错解决

来源:互联网 发布:java数组不定义长度 编辑:程序博客网 时间:2024/06/05 09:51

error C2664: 'CWnd::MessageBoxW' : cannot convert parameter 1 from 'const char [12]' to 'LPCTSTR'解决方案 

You will have to do one of two things:

  1. 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".
  2. Indicate that the string literal, in this case "Hello world!" is of a specific encoding. This can be done through either prefixing it withL, such as L"Hello world!", or surrounding it with the generic_T("Hello world!") macro. The latter will expand to theL prefix if you are compiling for unicode (see #1), and nothing (indicating multi-byte) otherwise.

 

0 0
原创粉丝点击