InitializeCriticalSectionEx is not member of global namespace in atlwinverapi.h

给你一囗甜甜゛ 提交于 2019-12-24 14:18:51

问题


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

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);

回答1:


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

#define _WIN32_WINNT 0x502 //NTDDI_VERSION

The fix was to delete this line.

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)


来源:https://stackoverflow.com/questions/47154505/initializecriticalsectionex-is-not-member-of-global-namespace-in-atlwinverapi-h

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!