I am trying to import a C++ MFC project from Visual Studio 2008 into VS 2019 community edition. The project originally came from outside my company long ago (like maybe twenty years). I am getting hundreds of compiler errors from an MFC include file named shlwapi.h because many symbols in it are multiply defined. Has anyone else seen this, and what can I do about it?
Edit: Here are some samples of the errors:
1>C:Program Files (x86)Windows Kits10Include10.0.19041.0umShlwapi.h(287,16): error C2084: function 'HRESULT SHLocalStrDupW(PCWSTR,PWSTR *)' already has a body
1>C:Program Files (x86)Windows Kits10Include10.0.19041.0umShlwapi.h(287): message : see previous definition of 'SHLocalStrDupW'
1>C:Program Files (x86)Windows Kits10Include10.0.19041.0umShlwapi.h(293,16): error C2084: function 'HRESULT SHLocalStrDupA(PCSTR,PSTR *)' already has a body
1>C:Program Files (x86)Windows Kits10Include10.0.19041.0umShlwapi.h(293): message : see previous definition of 'SHLocalStrDupA'
1>C:Program Files (x86)Windows Kits10Include10.0.19041.0umShlwapi.h(916,5): error C2365: 'URL_SCHEME_INVALID': redefinition; previous definition was 'enumerator'
When I click on the first line, I am taken to this code:
// make the above helper function a bit easier to use in the HRESULT world
inline HRESULT SHLocalStrDupW(_In_ PCWSTR psz, _Outptr_result_maybenull_ PWSTR *ppsz)
{
*ppsz = StrDupW(psz);
return *ppsz ? S_OK : E_OUTOFMEMORY;
}
When I click on the second line, the one that says "see previous definition", I am taken to the same place. It's like the include guard at the top of the file isn't working.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…