fatal error C1083: Cannot open include file: 'Windows.h': and scons

Using the above recommendations will not work with scons: scons does not import the user environment (PATH and other variables). The fundamental problem is that scons does not handle recent versions of SDKs/VS .

I am an occasional contributor to scons, and am working on this feature ATM. Hopefully, it will be included soon in scons, but the feature is much harder to implement reliably than I first expected, partly because every sdk/compiler combination is different (and sometimes even MS does not get it right, some of their .bat files are broken), so I can't give you a date. I hope it will be included in 1.2 (to be released in approximatively one month).


You need to set the include file path (and possibly other things). At the command line this is typically done using a batch file that Visual Studio installs called vsvars32.bat (or vcvars32.bat for compatibility with VC6).

I'm not familiar with scons so I don't know the best way to get these settings configured for that tool, but for standard makefiles there's usually a line in the makefile which sets a macro variable with the include directory path and that macro is used as part of a command line parameter in the command that invokes the compiler.

Another possibility might be to have the scons process invoke vsvars32.bat or run the scons script from a command line that has been configured with the batch file.

In short you need to get the things that vsvars32.bat configures into the scons configuration somehow.


There will be a batch file similar to this one (for MSVC 2005) that sets up the environment variables:

c:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat

Step 1: Find a similar file in the Express installation folders

Step 2: Create a shortcut on the desktop with these target details and a suitably modified path:

cmd.exe /K "c:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat"

Step 3: Open the DOS prompt via this shortcut

The command line build should now work from within this console window.