Saturday, September 19, 2020

Error C2440 '=': cannot convert from 'const char [24]' to 'PVOID'

when I compiled a legacy project SPAWNER from revo MFC book, I got this error

C2440 '=': cannot convert from 'const char [24]' to 'PVOID' SPAWNERX c:\demo_revo\spawnerx\spawnerx\spawndlg.cpp

I cast this type directly to (PVOID)

  1. Compiler Error C2440
  2. 'Conversion' : cannot convert from 'type1' to 'type2' The compiler cannot cast from type1 to type2. C2440 can be caused if you attempt to initialize a non-const char* (or wchar_t*) by using a string literal in C++ code, when the compiler conformance option /Zc:strictStrings is set. In C, the type of a string literal is array of char, but in C++, it is array of const char.

  3. /Zc:strictStrings (Disable string literal type conversion)

No comments:

Post a Comment