Friday, November 27, 2020

ERROR: Cannot convert from 'const char [..]' to 'LPCTSTR'

FAQ: Cannot convert from 'const char [..]' to 'LPCTSTR'

  1. FAQ: Cannot convert from 'const char [..]' to 'LPCTSTR'
  2. Resolution

    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 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.

  3. How to convert string to LPCTSTR?
  4. Convert char * to wchar*
  5. “c++ convert const char* to LPCWSTR” Code Answer
  6. good website for developer: codegrepper.com

  7. All C++ Answers
  8. good website for developer: codegrepper.com

  9. Converting 'const char*' to 'LPCTSTR' for CreateDirectory
  10. cannot convert from 'const char *' to 'LPCTSTR'

No comments:

Post a Comment