When installing the Windows SDK 6.1 and using the Visual Studio 2008 compiler, the following error message may be displayed in certain environments.

Cannot open include file: 'windows.h': No such file or directory

This error is caused by missing content in the batch file that sets up the Visual Studio build environment. The solution is as follows.

Search for and locate the windows.h header file in the C:\Program Files\Microsoft SDKs directory.
Example) C:\Program Files\Microsoft SDKs\Windows\v6.1\Include

Open the file C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat with an editor and add the path SDKs\windows\v6.0A\include, SDKs\windows\v6.0A\lib to the INCLUDE, LIB, and LIBPATH variables.

Example) line 26 @set Path to add to INCLUDE: C:\Program Files\Microsoft SDKs\Windows\v6.1\Include

@set INCLUDE=C:\Program Files\Microsoft SDKs\Windows\v6.1\Include;%VCINSTALLDIR%\ATLMFC\INCLUDE;%VCINSTALLDIR%\INCLUDE;%INCLUDE%\

Need more help with this?
Don’t hesitate to contact us here.

Thanks for your feedback.