17

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?

6 Answers 6

9

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.

Sign up to request clarification or add additional context in comments.

Comments

6

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

1 Comment

Setting these macros manually in project headers or code is exactly what causes this issue, typically years later, when someone inherits a project and tried to build it with a newer compiler or SDK. See also stackoverflow.com/a/34800328/2279059
2

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://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=vs-2019

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

Comments

1

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.

Comments

1

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)

Comments

1

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.