本文介绍了InitializeCriticalSectionEx不是atlwinverapi.h中全局名称空间的成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近从vs 2013移到了vs2017.我们有一个具有以下预处理程序定义的项目:

I have recently moved from vs 2013 to vs 2017. we have this project that has these preprocessor Definitions:

WIN32
DRG_BUILD_DLL
WINVER=0x0600

现在在atlwinverapi.h中,我收到以下错误消息:InitializeCriticalSectionEx不是全局名称空间的成员.任何想法为什么会发生此问题?

Now in atlwinverapi.h I get this error that InitializeCriticalSectionEx is not a member of global namespace. Any ideas why this problem is happening?

#if (NTDDI_VERSION >= NTDDI_VISTA) && !defined(_USING_V110_SDK71_) && !defined(_ATL_XP_TARGETING)
    // InitializeCriticalSectionEx is available in Vista or later, desktop or store apps
    return ::InitializeCriticalSectionEx(lpCriticalSection, dwSpinCount, Flags);

推荐答案

我也遇到了此错误,因为其中包含一个标头(为MSVC12编写)

I also got this error, because a header (written for MSVC12) included

#define _WIN32_WINNT 0x502 //NTDDI_VERSION

解决方法是删除此行.

此问题已修复,因为C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um\synchapi.h包含

This fixed it because C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um\synchapi.h contains

#if (_WIN32_WINNT >= 0x0600)
    InitializeCriticalSectionEx(
        _Out_ LPCRITICAL_SECTION lpCriticalSection,
        _In_ DWORD dwSpinCount,
        _In_ DWORD Flags
    );
#endif // (_WIN32_WINNT >= 0x0600)

这篇关于InitializeCriticalSectionEx不是atlwinverapi.h中全局名称空间的成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 00:49