Visual Studio 2015 Update 2 — solving issues
- Published:
After installing Update 2 for the popular freeware IDE program Microsoft Visual Studio 2015 Community, there were two issues when building some C++ projects with enabled support for Windows XP (“General” → “Platform Toolset” → “Visual Studio 2015 - Windows XP (v140_xp)” in project properties):
- the IDE was unable to find the
windows.h
header file (main WinAPI header), and that was causing a compiler’s fatal error:fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
there was an “Unresolved external” linker’s error when using functions like
GetModuleFileNameExW()
from the standard WinAPI libraryPsapi
:error LNK2019: unresolved external symbol _GetModuleFileNameExW@16 referenced in function […]
fatal error LNK1120: 1 unresolved externals
windows.h — fatal error
Looks like for projects oriented to be built with Windows XP support, the default value of the “Include Directories” parameter in the “VC++ Directories” section in project properties now contains $(WindowsSdk_71A_IncludePath)
instead of $(WindowsSDK_IncludePath)
. This can probably be treated as a step of Microsoft toward complete dropping of support for Windows XP as a target platform in Visual Studio.
So the issue can be solved by resetting the “Include Directories” parameter to default value (“inherit from parent or project defaults”) and re-adding previous additional paths to this new default value.
Psapi — unresolved external
As for Psapi
, what has helped is adding ;Psapi.lib
to the “Additional Dependencies” parameter in the “Linker” → “Input” section in project properties; so including psapi.h
is now not enough — we should explicitly link the static lib
library as well. The same probably applies to some other libraries.
P. S. By the way, executables generated by VS 2015 Update 2 are larger by about 20% compared with Update 1.