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.
3.       You are missing a Dirs file between the directory that you are building and the root of your platform where your sources.cmn resides.   Build.exe finds the sources.cmn file by searching up from the current folder until if finds a folder that does not have a Dirs file, then it goes down one more to open and process the sources.cmn file.  So a missing Dirs file will prevent it from processing your sources.cmn.
 
For more on the Platform Builder build system take a look at: Summary of Building Windows CE which lists the articles that I have written about building Windows CE using Platform Builder.
 
Copyright © 2009 – Bruce Eitman
All Rights Reserved