fatal error C1083: Cannot open include file: 'Windows.h': and scons
NickName:OscarRyz Ask DateTime:2008-10-17T11:58:42

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

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 the paths in environment variables. Well after printing them I find that it didn't:

 echo %INCLUDE%
 echo %LIB%
 echo %PATH% 

And they were not present, so I created this .bat file:

set PATH=%PATH%;"C:\Program Files\Microsoft Platform SDK\Bin"
set INCLUDE=%INCLUDE%;"C:\ Program Files\Microsoft Platform SDK\Include"
set LIB=%LIB%;"C:\ Program Files\Microsoft Platform SDK\Lib"

Still, scons seeems not to take the vars... :(

Copyright Notice:Content Author:「OscarRyz」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/211035/fatal-error-c1083-cannot-open-include-file-windows-h-and-scons

Answers
jussij 2008-10-17T05:33:13

There will be a batch file similar to this one (for MSVC 2005) that sets up the environment variables:\n\nc:\\Program Files\\Microsoft Visual Studio 8\\Common7\\Tools\\vsvars32.bat\n\n\nStep 1: Find a similar file in the Express installation folders\n\nStep 2: Create a shortcut on the desktop with these target details and a suitably modified path:\n\ncmd.exe /K \"c:\\Program Files\\Microsoft Visual Studio 8\\Common7\\Tools\\vsvars32.bat\"\n\n\nStep 3: Open the DOS prompt via this shortcut\n\nThe command line build should now work from within this console window.",


Windows programmer 2008-10-17T04:08:49

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.",


voxmea 2008-11-21T20:02:03

It'll be nice when scons does this automatically. For now, I use this (run from an SDK command prompt, not sure if there is a difference if run after vsvars32.bat):\n\nimport os\nenv = Environment(ENV={'PATH': os.environ['PATH']})\n\nenv['ENV']['TMP'] = os.environ['TMP']\nenv.AppendUnique(CPPPATH=os.environ['INCLUDE'].split(';'))\nenv.AppendUnique(LIBPATH=os.environ['LIB'].split(';'))\n",


David Cournapeau 2008-10-17T05:54:18

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 .\n\nI 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).",


Michael Burr 2008-10-17T04:56:43

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).\n\nI'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.\n\nAnother 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.\n\nIn short you need to get the things that vsvars32.bat configures into the scons configuration somehow.",


More about “fatal error C1083: Cannot open include file: 'Windows.h': and scons” related questions

fatal error C1083: Cannot open include file

I looked at previous post based on this but they do not relate. I am receiving the following error. 1&gt;c:\users\numerical25\desktop\intro todirectx\introtodirectx\chapter 4\init direct3d\init di...

Show Detail

fatal error C1083: Cannot open include file: 'excpt.h' and 'ctype.h'

I'm trying to build TortoiseSVN and when I run nant setup, I get these build errors and I'm not sure how to resolve them. There are similar posts on SO but they're outdated or do not apply to my

Show Detail

VS 2008: Fatal error C1083: Cannot open include file: ...: Invalid argument

I've seen lots of questions about Fatal Error C1083 "No such file or directory", but in my case I am seeing "Invalid argument". I am on 32-bit Windows trying to compile some C++ code which uses Bo...

Show Detail

fatal error C1083: Cannot open include file: 'Hoa.h': No such file or directory

Here is my code and it's giving the above mentioned error in 3rd line... ambisonic_3d.h #ifndef __DEF_HOA_3D_AMBISONIC__ #define __DEF_HOA_3D_AMBISONIC__ #include "Hoa.h" //! The 3D ambisonic cl...

Show Detail

fatal error C1083: Cannot open include file: 'QtWebEngineWidgets': No such file or directory

used this QT += webenginewidgets in its associated pro files. But still getting the error of fatal error C1083: Cannot open include file: 'QtWebEngineWidgets': No such file or directory I am

Show Detail

QT: fatal error C1083: Cannot open include file: 'type_traits'

I've been spending almost all day trying to get QT installed on my windows machine. I have installed QTCreator with QT 5.14.1 and QWT 6.1.3 (have also tried 6.2.0) and following these instructions ...

Show Detail

Botan cannot be installed fatal error C1083: Cannot open include file: 'cstddef'

I gonna install botan to use lib encryption. When I have run command nmake after run py configure.py ... This error showed and I don't konw what I can do ? fatal error C1083: Cannot open include fi...

Show Detail

fatal error C1083: Cannot open include file while compiling a Cython file

When I tried to compile a cython file, I got this error. C:\Users\xxx.\AppData\Local\Programs\Python\Python39\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such fi...

Show Detail

fatal error C1083: Cannot open include file: 'pcap.h'

fatal error C1083: Cannot open include file: 'pcap.h': No such file or directory. How to add .pcap.h file? I am doing VC++ project in windows 7 32-bit

Show Detail

Fatal error C1083 when compiling wxWidgets on windows

https://github.com/kyledavis124/guide/tree/refactor I am trying to add wxWidgets to my project as a subdirectory. I keep getting the errors, &quot;C:\Program Files (x86)\JetBrains\CLion 2021.1.3\bin\

Show Detail