# Troubles with Windows target versions

I recently migrated an old VC++ project to use the Visual Studio 2017 toolset and when compiling I run into the following errors about redefining the structure tagTOUCHINPUT:

```1>c:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.16.27023\atlmfc\include\afxwin.h(2175): error C2011: 'tagTOUCHINPUT': 'struct' type redefinition
1>c:\program files (x86)\windows kits\8.1\include\um\winuser.h(5865): note: see declaration of 'tagTOUCHINPUT'
1>c:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.16.27023\atlmfc\include\afxwin.h(2177): error C2011: 'tagGESTUREINFO': 'struct' type redefinition
1>c:\program files (x86)\windows kits\8.1\include\um\winuser.h(14763): note: see declaration of 'tagGESTUREINFO'
```

The tagTOUCHINPUT is defined as follows in WinUser.h

```#if(WINVER >= 0x0601)

DECLARE_HANDLE(HTOUCHINPUT);

typedef struct tagTOUCHINPUT {
LONG x;
LONG y;
HANDLE hSource;
DWORD dwID;
DWORD dwFlags;
DWORD dwTime;
ULONG_PTR dwExtraInfo;
DWORD cxContact;
DWORD cyContact;
} TOUCHINPUT, *PTOUCHINPUT;
typedef TOUCHINPUT const * PCTOUCHINPUT;

#endif```

However, afxwin.h also defines it as shown below:

```#if (NTDDI_VERSION < NTDDI_WIN7)
typedef struct tagTOUCHINPUT {
} TOUCHINPUT, *PTOUCHINPUT;
typedef struct tagGESTUREINFO {
} GESTUREINFO, *PGESTUREINFO;
#endif```

The first defines it if WINVER is specifying at least Windows Vista, the second if NTDDI_VERSION is less than Windows 7. Looking in stdafx.h I could see the following definitions:

```#ifndef WINVER
#define WINVER 0x0601
#endif

#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif

#ifndef _WIN32_WINDOWS
#define _WIN32_WINDOWS 0x0501
#endif

#ifndef _WIN32_IE
#define _WIN32_IE 0x0400
#endif```

It looked like NTDDI_VERSION was missing so I defined it to refer to Windows 7.

```#ifndef NTDDI_VERSION
#define NTDDI_VERSION NTDDI_WIN7
#endif ```

With this, the previous compiling errors were gone, but a new error appeared:

```1>c:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.16.27023\atlmfc\include\atlwinverapi.h(730): error C2039: 'InitializeCriticalSectionEx': is not a member of '`global namespace''