简体   繁体   English

VS 2015 编译器错误“LCMapStringEx”:找不到标识符

[英]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++/MFC 代码使用 VS 2013 编译得很好,但是当我使用 VS 2015 编译时,我得到了这个错误:

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?我在代码中的任何地方都没有使用 LCMapString,所以我不知道这是从哪里来的?

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.对我来说原因是这样的:项目的一部分以支持 XP 的方式设置了 _WIN32_WINNT,其他文件没有这个定义。 So the MFC headers were included with different values for the supported platform leading to this strange error.因此,MFC 标头包含在受支持平台的不同值中,从而导致了这个奇怪的错误。

The definition is guarded for the minimum target windows version.该定义受最低目标 Windows 版本保护。 This guard uses one of your definitions or NTDDI_VERSION (which is created from the other definition within (sdkddkver.h).这个守卫使用你的一个定义或 NTDDI_VERSION(它是从 (sdkddkver.h) 中的另一个定义创建的)。

Correcting the version details of _WIN32_WINNT, WINVER solved the issue.修正_WIN32_WINNT的版本细节,WINVER解决了问题。 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这里 0A00 适用于 windows10。请参阅以下链接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.我不得不手动删除以前编译器生成的所有 obj 文件,因为 VS 2015 中的清理和重建选项似乎没有正确删除它们。

Correcting the version details of _WIN32_WINNT, _WIN32_WINNT solved the issue.修正_WIN32_WINNT的版本信息,_WIN32_WINNT解决了问题。

you can see the similar thread here.你可以在这里看到类似的线程。

Compile Errors upgrading ATL project from vs2010 to vs2013 将 ATL 项目从 vs2010 升级到 vs2013 时出现编译错误

(WINVER or _WIN32_WINNT) (WINVER 或 _WIN32_WINNT)

I faced similar issue when I migrated project from Visual Studio 2005 to Visual Studio 2015.当我将项目从 Visual Studio 2005 迁移到 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.在记事本或任何您喜欢的编辑器中打开 Vcxproj,然后搜索<PreprocessorDefinitions>标记,在我删除 WINVER=0x0501 的情况下,当我删除它开始工作时。

In StdAfx.h define the following macros:在 StdAfx.h 中定义以下宏:

//For Windows 10 //对于Windows 10

NTDDI_VERSION 0x0A000000 NTDDI_VERSION 0x0A000000

#define WINVER 0x0A00 #define WINVER 0x0A00

#define _WIN32_IE 0x0A00 #define _WIN32_IE 0x0A00

Also refer below MSDN links for WINVER & NTDDI_VERSION according to your environment.另请根据您的环境参考以下 MSDN 链接以获取 WINVER 和 NTDDI_VERSION。

https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=vs-2019 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 https://docs.microsoft.com/en-us/windows/win32/winprog/using-the-windows-headers

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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