Platform Builder: Cannot open include file: windows.h: No such file or directory
The following is unique to Platform Builder, and applies to any version. The problem is that when building a driver, BSP or sub-project, the compiler fails with the error message “Cannot open include file: windows.h: No such file or directory.”
There are probably many ways to cause this error. Many of these are simple user error, like accidently deleting or moving windows.h. But let’s focus on the most likely problems that can cause this.
1. The most common cause that I have run into is that the project has not been sysgened. That is you have not run Sysgen yet. Sysgen is an important build step because sysgen processes the Public code, including header files, bib files, reg files and others, to create a unique set of files for a given project. The results are a set of files stored in the project tree. When building a driver, BSP or sub-project, the INCLUDES path is set to find the header files created by sysgen. So, if you haven’t run Sysgen you are missing some important files. Since most C/C++ code in Platform Builder includes windows.h, this error is one of the first signs that the project has not been sysgened.
2. The INCLUDES path has been broken. The compiler finds header files by searching folders designated in the INCLUDES path. If the INCLUDES path does not include the path to windows.h then of course the compiler will not find windows.h. Windows.h will be found in $(_COMMONSDKROOT)\INC. _COMMONSDKROOT is set to $(_PROJECTROOT)\CESYSGEN\SDK. This include path can also be set using _OEMINCPATH in sources.cmn.