Friday, February 21, 2020

Win32 leagacy recompilation error fixes

Win32 leagacy recompilation error fixes

    Error C1189 #error:

    MFC does not support WINVER less than 0x0501. Please change the definition of WINVER in your project properties or precompiled header. PrintDlg c:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.16.27023\atlmfc\include\afxv_w32.h 40

  1. Update WINVER and _WIN32_WINNT
  2. o modify the macros, in a header file (for example, in targetver.h, which is included by some project templates that target Windows), add the following lines.

    #define WINVER 0x0A00

    #define _WIN32_WINNT 0x0A00

    usually defining these macro in stdAfx.h file is good.

    Error D8016 '/ZI' and '/Gy-' command-line options are incompatible

  1. Visual Studio error D8016: '/ZI' and '/Gy' command-line options are incompatible
  2. #visual studio # Error D8016 '/ZI' and '/Gy-' command-line options are incompatible
  3. solution is:

    the same issue got, resolved by changing Project ➔ Properties ➔ C/C++ ➔ General ➔ Debug Information Format ➔ Program Database (/Zi)

    Error C2664 'int StringFromGUID2(const GUID &,LPOLESTR,int)': cannot convert argument 2 from 'USHORT [100]' to 'LPOLESTR'

  1. How do I create a variable or constant of type LPOLESTR?
  2. A light wrapper class for GUID

Error C2440 '=': cannot convert from 'const char [6]' to 'LPSTR' Tooltips c:\demo\tooltips\tooltips\tooltips.cpp 292

code snippet is: ((NMTTDISPINFO*)hdr)->lpszText = "Lines"; when I build tooltip project in Visual C++ project.

My solution:((NMTTDISPINFO*)hdr)->lpszText = (LPSTR)"Lines";

  1. Compiler Error C2440
  2. this is official explanation from Microsoft.

  3. cannot convert from 'const char *' to 'LPCTSTR'
  4. cannot convert from 'const char *' to 'LPCTSTR'
  5. cannot convert from 'const char *' to 'LPCTSTR'
  6. ERROR C2440

No comments:

Post a Comment