Visual C++ 2008里cannot convert parameter 1 from 'const char [13]' to 'LPCTSTR'造成不能运行的原因主要是2005和2008中增加了一些参数类型的安全性检查,所以通常在6.0没有问题的LPCTSTR与 const char之间的转换到了这里就玩不转。微软给出的解决办法有两个:
- 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.