Alex Rivera | Logout

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

Asked 2008-10-17T03:58:42.413
10

Today is officially my first day with C++ :P

I've downloaded Visual C++ 2005 Express Edition and Microsoft Platform SDK for Windows Server 2003 SP1, because I want to get my hands on the open source Enso Project.

So, after installing scons I went to the console and tried to compile it using scons, but I got this error:

C:\oreyes\apps\enso\enso-read-only\src\platform\win32\Include\WinSdk.h(64) : fatal error C1083: Cannot open include file: 'Windows.h': No such file or directory
scons: *** [src\platform\win32\InputManager\AsyncEventProcessorRegistry.obj] Error 2
scons: building terminated because of errors.

After checking these links:

VS ans PSDK

Include tiffi.h

Wndows.h

I've managed to configure my installation like this:

alt text

And even run this script

alt text

And I managed to compile the file below in the IDE.

// Test.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <Windows.h>


int _tmain(int argc, _TCHAR* argv[])
{
    return 0;
}

But I still get that exception in the console. Does anyone have scons experience?

EDIT

Actually (and I forgot to tell you this) I started the command prompt with the link "Visual Studio 2005 Command Prompt".

I assume this will include

Edit
Report

3 Answers

8

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).

answered 2008-10-17T05:54:18.187
0

You show us how you configured Visual Studio for compilations within Visual Studio but you didn't show us what command line environment you tried. Sorry I haven't tried Express versions so I don't know if they create additional Start menu shortcuts like Pro and above do. If you open a suitable command prompt with its environment variables already set then you can compile on the command line. Otherwise you have to set variables yourself or execute a batch script to set them, each time you open a command prompt.

answered 2008-10-17T04:08:49.197
0

This works for me while compiling wxwidgets with Visual C++ 2005 Express using the command line prompt:

REM Fix Error error C1083 'windows.h'

(Use /useenv option when compiling.)

set PDSKWIN=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2

(Change to the right one.)

set INCLUDE=%PDSKWIN%\Include;%INCLUDE%

set LIB=%PDSKWIN%\Lib;%LIB%

Then I use this line when compiling. I believe just add /useenv to your lines and everything should work fine:

vcbuild /useenv /nohtmllog /nologo name.proj (or any file to compile)
answered 2009-02-09T13:36:47.910

Your Answer