CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12
  1. #1
    Join Date
    Sep 2008
    Posts
    119

    "windows.h no such file or directory" in Visual Studio 2008! Help

    I wrote simple "hello world" by MFC. I get this error message

    ***fatal error 1083: windows.h no such file or directory***

    Note: i'm using Visual Studio 2008 - full version in college, so i do not have permission to install anything...

    Any suggestions?

  2. #2
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917

    Re: "windows.h no such file or directory" in Visual Studio 2008! Help

    Start Visual Studio. Go to Tools->Options and expand Projects and solutions.
    Select VC++ Directories from the tree and choose Include Files from the combo on the right.

    You should see: $(WindowsSdkDir)\include - (default.)
    If this is missing, you found a problem. If not, search for a file. It should be located in
    C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include if VS was installed in default directory.
    Enter path for windows.h in the new line of above mentioned place.

    windows.h should be from proper version of the SDK installation, otherwise your program may not compile.
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: "windows.h no such file or directory" in Visual Studio 2008! Help

    Quote Originally Posted by f.ben.isaac View Post
    I wrote simple "hello world" by MFC. I get this error message

    ***fatal error 1083: windows.h no such file or directory***

    Note: i'm using Visual Studio 2008 - full version in college, so i do not have permission to install anything...

    Any suggestions?
    Did you use the MFC app wizard or write the code by hand?

  4. #4
    Join Date
    Sep 2008
    Posts
    119

    Re: "windows.h no such file or directory" in Visual Studio 2008! Help

    Quote Originally Posted by JohnCz View Post
    Start Visual Studio. Go to Tools->Options and expand Projects and solutions.
    Select VC++ Directories from the tree and choose Include Files from the combo on the right.

    You should see: $(WindowsSdkDir)\include - (default.)
    If this is missing, you found a problem. If not, search for a file. It should be located in
    C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include if VS was installed in default directory.
    Enter path for windows.h in the new line of above mentioned place.

    windows.h should be from proper version of the SDK installation, otherwise your program may not compile.

    I followed your instructions:
    i have seen several lines in the list, $(WindowsSdkDir)\include was one of them

    However, i went to C:\Program Files\Microsoft SDKs\Windows\v6.0A\,

    v6.0A folder only contains bin & Bootstrapper. There isn't "include" folder.

    Underneath Windows folder, there are v6.0A and v5.0. v5.0 folder contains lib & include folders...

    I put C:\Program Files\Microsoft SDKs\Windows\v5.0\include in place of $(WindowsSdkDir)\include, i got this error while building

    Error 1 fatal error C1189: #error : Your version of the Windows SDK is earlier than 6.0. Try setting the 'WINVER' and '_WIN32_WINNT' definitions in your project to less than 0x0600. c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxwin.h 26 hello


    Then i tried to put all these paths together in the list:
    C:\Program Files\Microsoft SDKs\Windows\v5.0
    C:\Program Files\Microsoft SDKs\Windows\v6.0A
    $(WindowsSdkDir)\include
    .
    .
    many more included by default.

    I rebuild, i got same old error

    fatal error 1083: windows.h no such file or directory

    Any idea?! Odd
    Last edited by f.ben.isaac; November 24th, 2008 at 04:22 PM.

  5. #5
    Join Date
    Sep 2008
    Posts
    119

    Re: "windows.h no such file or directory" in Visual Studio 2008! Help

    Quote Originally Posted by Arjay View Post
    Did you use the MFC app wizard or write the code by hand?
    Referring to the tutorial, it said to choose Win32 App. Note: the tutorial is using a quite old version of VC++....

  6. #6
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917

    Re: "windows.h no such file or directory" in Visual Studio 2008! Help

    V5.0 is not for x86 processor. Use v6.0A.
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

  7. #7
    Join Date
    Sep 2008
    Posts
    119

    Re: "windows.h no such file or directory" in Visual Studio 2008! Help

    Quote Originally Posted by JohnCz View Post
    V5.0 is not for x86 processor. Use v6.0A.
    Ok...I just did it, i still get this annoying error!

    fatal error 1083: windows.h no such file or directory

    I guess there was a problem in the installation process

    I used this header in my code #include <afxwin.h>
    windows.h is inside afxwin.h
    Last edited by f.ben.isaac; November 24th, 2008 at 05:02 PM.

  8. #8
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: "windows.h no such file or directory" in Visual Studio 2008! Help

    You've mentioned in your first post that you are using Visual Studio 2008.

    I'm confused by the fact that versions 5.0 and 6.0a are mentioned.

    What Visual Studio version are you using?

  9. #9
    Join Date
    Sep 2008
    Posts
    119

    Re: "windows.h no such file or directory" in Visual Studio 2008! Help

    Quote Originally Posted by Arjay View Post
    You've mentioned in your first post that you are using Visual Studio 2008.

    I'm confused by the fact that versions 5.0 and 6.0a are mentioned.

    What Visual Studio version are you using?
    Visual Studio 2008

    Our faculty machines have Visual Studio 2005, 2008, and .NET 2003

  10. #10
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917

    Re: "windows.h no such file or directory" in Visual Studio 2008! Help

    Hi Arjay,
    VS 2008 does not have Windows.h in native installation folder. This file is located in SDK installation folder. There are two folders located under Microsoft SDKs: \Windows\v6.0A\Include and \Windows\v5.0\Include.

    V6.0A is for x86.
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

  11. #11
    Join Date
    Sep 2008
    Posts
    119

    Re: "windows.h no such file or directory" in Visual Studio 2008! Help

    Quote Originally Posted by JohnCz View Post
    Hi Arjay,
    VS 2008 does not have Windows.h in native installation folder. This file is located in SDK installation folder. There are two folders located under Microsoft SDKs: \Windows\v6.0A\Include and \Windows\v5.0\Include.

    V6.0A is for x86.
    What should i do to have windows.h?

    THANKS

  12. #12
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917

    Re: "windows.h no such file or directory" in Visual Studio 2008! Help

    Well, it is hard to determine what is the problem without actually trying to build with your settings.
    If windows.h exists in C:\Program Files\Microsoft SDKs\Windows\v6.0A\ directory your settings are wrong.

    You may have settings mixed from other versions of VS.

    Create new project using app wizard and build it. See if the error persists.
    If yes, export current settings and reset all VS settings to default value.
    Build and see if problem is still there. If it is we will have to take it from there.
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured