This error occurs when compiling the program because the character set Unicode properties are formatted when you create a new MFC project.
Workaround One:
In the VC2010 Solution Manager window, right-click your project "project", then "Properties" (the last item), then "Configuration Properties", a "+" sign, expand it, then select the "General" tab, the third-lowest "character set", and choose "Use multibyte Character set". Problem solving.
However, it is recommended to use Unicode, otherwise your program will have great limitations, if your program is only in the West, but after all, is adapted to the Chinese mainland procedures, so it is recommended to use Unicode.
Workaround Two:
Use call cstring::allocsysstring ();
For example:
CString str_cap ("haha");
(Const WCHAR *) (Str_cap. AllocSysString ());
(LPCTSTR) (Str_cap. AllocSysString ()); Same effect as above
Http://www.cnblogs.com/qiyebao/archive/2011/12/01/2270951.html
"Reprint" C + + Compile error C2664: cannot convert parameter 2 from "const char [5]" to "LPCTSTR" solution.