简体   繁体   中英

VS 2015 compiler error 'LCMapStringEx': identifier not found

My C++/MFC code compiles fine with VS 2013 but when I have compiled with VS 2015 I get this error:

C:\VS\VC\atlmfc\include\atlwinverapi.h(710): 
error C3861: 'LCMapStringEx': identifier not found

I don't use LCMapString anywhere in my code, so I don't know where this come from?

I had the same problem. For me the cause was this: Part of the project had _WIN32_WINNT set in such a way that XP was supported, other files didn't have this define. So the MFC headers were included with different values for the supported platform leading to this strange error.

The definition is guarded for the minimum target windows version. This guard uses one of your definitions or NTDDI_VERSION (which is created from the other definition within (sdkddkver.h).

Correcting the version details of _WIN32_WINNT, WINVER solved the issue. Go to:

Properties->Configuration properties->C/C++->Preprocessor->Preprocessor 

Definitions and check what macros are defined.

changing them to

NTDDI_VERSION= 0x06030000
WINVER=0x0A00
_WIN32_WINNT=0x0A00

solved my problem. Here 0A00 is for windows10.Refer below link https://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.85).aspx

I Solved the problem. I had to manually delete all the obj files generated by the previous compiler, as the clean and rebuild option in VS 2015 seems that did not remove them correctly.

Correcting the version details of _WIN32_WINNT, _WIN32_WINNT solved the issue.

you can see the similar thread here.

Compile Errors upgrading ATL project from vs2010 to vs2013

(WINVER or _WIN32_WINNT)

I faced similar issue when I migrated project from Visual Studio 2005 to Visual Studio 2015.

Open the Vcxproj in notepad or any of your favorite editors and then search for <PreprocessorDefinitions> tag in my case I removed the WINVER=0x0501, when I removed it started working.

In StdAfx.h define the following macros:

//For Windows 10

NTDDI_VERSION 0x0A000000

#define WINVER 0x0A00

#define _WIN32_IE 0x0A00

Also refer below MSDN links for WINVER & NTDDI_VERSION according to your environment.

https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=vs-2019

https://docs.microsoft.com/en-us/windows/win32/winprog/using-the-windows-headers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM