Thursday, August 29, 2013

Solving C1083 error for Visual Studio 2012 Express with Windows Kit

To solve error c1083 cannot open include file 'windows.h' no such file or directory
===========================================================
(The following solution assume, you have installed Visual Studio 2012 Express / Windows Kit for x86 or x64 platforms)

  • Change the following properties (if you installed the SDK to a different location, replace the SDK path with your custom install location):

  • - In “Executable Directories” replace $(WindowsSdkDir)bin with $(ProgramFiles)\Windows Kits\8.0\bin\x86
    - In “Include Directories” add $(ProgramFiles)\Windows Kits\8.0\Include\um;$(ProgramFiles)\Windows Kits\8.0\Include\shared at the beginning and remove $(WindowsSdkDir)include
    - In “Library Directories” replace $(WindowsSdkDir)lib with $(ProgramFiles)\Windows Kits\8.0\lib\win8\um\x86
    - In “Exclude Directories” replace $(WindowsSdkDir)include with $(ProgramFiles)\Windows Kits\8.0\Include\um;$(ProgramFiles)\Windows Kits\8.0\Include\shared
    - When targeting x64, replace x86 with x64

    That’s it – you should be ready to build and run!

    Ref : You can dynamically include path of Program Files folder using the following in Windows.
              On 64bit Windows, things are a little more complicated, as application can be installed both in
               %ProgramFiles% and %ProgramFiles(x86)%