i'm performing testing on windows 7 x64 using visual studio 2012. appears microsoft's toolchain setting _win32_winnt
0x602
(_win32_winnt_win8
). running our test program results in the procedure entry point getoverlappedresultex not located in dynamic link library kernel32.dll
:
i have 2 questions. first, out of morbid curiosity, why microsoft setting _win32_winnt
value that's not valid execution environment? can understand if user wants it, not microsoft since breaks things (q.v.).
second, how set winver
or _win32_winnt
symbolic "this platform"? in case, "this platform" windows 7. when test on windows vista, different platform. when test on windows 8, platform. , when test under arm developer prompt windows phone , windows store, yet platform.
the problem easy duplicate. here steps. imagine testing environment has first 8 steps.
- stand windows 7, x64 machine
- fully patch windows 7 machine
- install visual studio 2008
- fully patch visual studio 2008
- install visual studio 2010
- fully patch visual studio 2010
- install visual studio 2012
- fully patch visual studio 2012
then:
- create empty "hello world" project under vs2008
- delete everything except
hello_world.cpp
(this should leave 1 solution file, , 1 project file, 1 source file) - convert vs2010
- open vs2012
i can post mcve, empty source file, appease folks. seems waste of time since problem toolchain , not source file. empty main
crucial problem? wrong winver
, _win32_winnt
set regardless of what's in file.
i know origin of error. our code changed better support windows 8, phone 8, store 8, server 2012, windows 10, phone 10, store 10 , windows universal platform. changes so:
#if defined(cryptopp_win32_available) # if ((winver >= 0x0602 /*_win32_winnt_win8*/) || (_win32_winnt >= 0x0602 /*_win32_winnt_win8*/)) # include <synchapi.h> # include <ioapiset.h> # define use_windows8_api # endif #endif ... #if defined(use_windows8_api) bool result = getoverlappedresultex(gethandle(), &m_overlapped, &m_lastresult, infinite, false); #else bool result = getoverlappedresult(gethandle(), &m_overlapped, &m_lastresult, false); #endif
ironically, added use_windows8_api
, additional includes , calls getoverlappedresultex
appease tools in first place. complaining deprecated functions , causing dirty compiles. dirty compiles creating governance, c&a , st&e problems users.
i audited code ensure not unintentionally or incorrectly setting values. verified in 1 place, , code path not activated because microsoft's toolchain setting value 0x602
:
#ifdef cryptopp_win32_available # ifndef _win32_winnt # define _win32_winnt 0x0400 # endif #endif
here's related stack overflow question: what winver?, not discuss how set "this platform".
here's microsoft's docs on subject: using windows headers , modifying winver , _win32_winnt. ironically, don't discuss problem or windows 10, windows phone 10, windows store 10 or windows universal platform.
as aside, gcc has quasi-similar -march=native
provides "this platform".
if don't explicitly provide target platform version, windows sdk select default 1 (see sdk's sdkddkver.h file details).
for example, windows 8.0 sdk sdkddkver.h file has following snippet:
#if !defined(_win32_winnt) && !defined(_chicago_) #define _win32_winnt 0x0602 #endif
if don't want default selection, you'll need configure target platform version defining _win32_winnt
and/or related macros appropriately. can using /d
compiler option in project settings or makefile, or can define in source files or common header included before including sdk headers.
something /d _win32_winnt=0x0601
might appropriate (0x0601 corresponds win7).