CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: [RESOLVED] Persistent "Cannot open include file: 'windows.h'" issue

  1. #1
    Join Date
    Nov 2007
    Location
    Gainesville, FL
    Posts
    9

    [RESOLVED] Persistent "Cannot open include file: 'windows.h'" issue

    Hi gurus!

    I gather this is a fairly common issue from my digging through these and other forums, so I will outline what I have done and hopefully we can resolve this quickly. Sorry if it's a bit long but I wanted to give all the info typically asked for... I should add that I am VERY new to C++, but starting to find my way.

    I am running MS Visual C++ 2005 Express Edition. The code I am trying to compile was originally written for Unix, and we now HAVE to get it compiling on Windows. It requires the Boost and PETSc libraries, among others, which I have installed.

    Following my research into this I learnt that windows.h is a part of SDK, which I web-installed from http://www.microsoft.com/downloads/d...displaylang=en (I skipped the documentation and samples portions of the install). I have ensured Step 3 of the installation instructions (http://msdn2.microsoft.com/en-us/express/aa700755.aspx) was followed as regularly suggested on various forums, as well as Step 4 though I'm unsure whether I need to worry about that one - all I need to do is get the code to compile at this stage.

    After trying to build I get this output:

    ------ Rebuild All started: Project: tarse, Configuration: Release Win32 ------
    Deleting intermediate and output files for project 'tarse', configuration 'Release|Win32'
    Compiling...
    XMLUtils.cpp
    C:\Program Files\boost\boost_1_34_1\boost/date_time/microsec_time_clock.hpp(23) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
    WQErrorDefines.cpp
    WQAlone.cpp
    WaterQualityGenericInterface.cpp
    C:\Program Files\boost\boost_1_34_1\boost/date_time/microsec_time_clock.hpp(23) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
    Project : warning PRJ0018 : The following environment variables were not found:
    $(IDB_PATH)
    Build log was saved at "file://c:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\tarse\tarse\tarse\Release\BuildLog.htm"
    tarse - 2 error(s), 0 warning(s)
    ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

    Firstly, is the presence of \'s and /'s in a single path part of the problem? e.g. "C:\Program Files\boost\boost_1_34_1\boost/date_time/microsec_time_clock.hpp(23) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory" (I said I was new to this ;-)

    I did a search for windows.h on my system and found a file named windows.h in C:\cygwin\usr\include\w32api (needed to install PETSc) and another named Windows.h (capitalization important?) in C:\Program Files\Microsoft SDKs\Windows\v6.1\Include.

    My Additional Include Directories under Project > Properties > Configuration Properties > C/C++ > General are:
    "C:\Program Files\boost\boost_1_34_1";"C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\tarse\tarse\tarse\src";"$(MPICH2)\include";"$(PETSC_DIR)";"$(PETSC_DIR)\bmake\$(PETSC_ARCH)";"$(PETSC_DIR)\include";"$(LIBXML_DIR)\include";"$(LIBXML_DIR)\include\libxml"

    I wont include the Executable, Include and Library files in the Project and Solutions VC++ Directories but I will provide them if needed.

    THANK YOU!!

  2. #2
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Persistent "Cannot open include file: 'windows.h'" issue

    Have never runned express myself but think I've read (on this forum) that the SDK installation doesn't add C:\Program Files\Microsoft SDKs\Windows\v6.1\Include or other SDK include path's.

    Edit: Here's one link that describes some mods that has to be done http://msdn2.microsoft.com/en-gb/express/aa700755.aspx
    Edit2: Another link http://www.codeguru.com/forum/showthread.php?t=447411
    Last edited by S_M_A; March 18th, 2008 at 04:27 PM.

  3. #3
    Join Date
    Nov 2007
    Location
    Gainesville, FL
    Posts
    9

    Re: Persistent "Cannot open include file: 'windows.h'" issue

    Thanks S_M_A - that last link you provided actually had the information I needed! As expected, it was just a matter of adding the right path for the necessary directories. Looks like the directories I added previously were incorrect for the version of PSDK I have.

    Thanks very much!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)