问题
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