locked
compiler cannot find windows.h RRS feed

  • Question

  • I tried to compile an existing program (which I want to modify).  The
    program is written in C++.  So I downloaded Microsoft's Visual C++
    Express edition and I tried to compile the program.  It failed to
    compile, and the error I got was that "windows.h" could not be found.
    I did a search in my computer for windows.h, and it was in the Microsoft Platform SDK\include directory and I looked at my compiler 'directories' menu option and saw that I had added that directory.  Furthermore I had modified various files that the compiler uses as specified in msdn instructions.  But still the compiler cannot find Windows.h. 

    Here's the error message:
    ------ Build started: Project: FullDuplexFilter, Configuration: Debug
    Win32 ------
    Compiling...
    dxstdafx.cpp
    c:\dirxsdk\samples\c++\common\dxstdafx.h(43) : fatal error C1083:
    Cannot open include file: 'windows.h': No such file or directory
    Build log was saved at
    "file://c:\dirxsdk\Samples\C++\DirectSound\FullDuplexFilter\Debug\BuildLog.­htm"
    FullDuplexFilter - 1 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
    ==========

    searchstring: Blackdog visual

    Sunday, February 26, 2006 12:52 PM

Answers

  •  BLACKDOG2 wrote:

    I tried to compile an existing program (which I want to modify).  The
    program is written in C++.  So I downloaded Microsoft's Visual C++
    Express edition and I tried to compile the program.  It failed to
    compile, and the error I got was that "windows.h" could not be found.
    I did a search in my computer for windows.h, and it was in the Microsoft Platform SDK\include directory and I looked at my compiler 'directories' menu option and saw that I had added that directory.  Furthermore I had modified various files that the compiler uses as specified in msdn instructions.  But still the compiler cannot find Windows.h. 

    Here's the error message:
    ------ Build started: Project: FullDuplexFilter, Configuration: Debug
    Win32 ------
    Compiling...
    dxstdafx.cpp
    c:\dirxsdk\samples\c++\common\dxstdafx.h(43) : fatal error C1083:
    Cannot open include file: 'windows.h': No such file or directory
    Build log was saved at
    "file://c:\dirxsdk\Samples\C++\DirectSound\FullDuplexFilter\Debug\BuildLog.­htm"
    FullDuplexFilter - 1 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
    ==========

    searchstring: Blackdog visual

    I'm assuming you followed the video available in the VCExpress site.

    Is the PlatformSDK include directory present in the list when you do: Tools-> Options-> Projects and Solutions-> VC++ Directories-> Show directories for: Include files?

    (Important: that last step was not performed in the video, it was a mistake made in the video that Microsoft have yet to correct).

    As an alternative to fiddling with the include directories, you may be reinstall (that's uninstall then reinstall) the Platform SDK from C:\Program Files\Microsoft Platform SDK to:

    C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK

    Sunday, February 26, 2006 4:02 PM

All replies

  •  BLACKDOG2 wrote:

    I tried to compile an existing program (which I want to modify).  The
    program is written in C++.  So I downloaded Microsoft's Visual C++
    Express edition and I tried to compile the program.  It failed to
    compile, and the error I got was that "windows.h" could not be found.
    I did a search in my computer for windows.h, and it was in the Microsoft Platform SDK\include directory and I looked at my compiler 'directories' menu option and saw that I had added that directory.  Furthermore I had modified various files that the compiler uses as specified in msdn instructions.  But still the compiler cannot find Windows.h. 

    Here's the error message:
    ------ Build started: Project: FullDuplexFilter, Configuration: Debug
    Win32 ------
    Compiling...
    dxstdafx.cpp
    c:\dirxsdk\samples\c++\common\dxstdafx.h(43) : fatal error C1083:
    Cannot open include file: 'windows.h': No such file or directory
    Build log was saved at
    "file://c:\dirxsdk\Samples\C++\DirectSound\FullDuplexFilter\Debug\BuildLog.­htm"
    FullDuplexFilter - 1 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
    ==========

    searchstring: Blackdog visual

    I'm assuming you followed the video available in the VCExpress site.

    Is the PlatformSDK include directory present in the list when you do: Tools-> Options-> Projects and Solutions-> VC++ Directories-> Show directories for: Include files?

    (Important: that last step was not performed in the video, it was a mistake made in the video that Microsoft have yet to correct).

    As an alternative to fiddling with the include directories, you may be reinstall (that's uninstall then reinstall) the Platform SDK from C:\Program Files\Microsoft Platform SDK to:

    C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK

    Sunday, February 26, 2006 4:02 PM
  • Guys, I think I may have stumbled across the more general problem with Express. MS's Brian Johnson explained (Here: http://lab.msdn.microsoft.com/express/visualc/usingpsdk/default.aspx ) in this statement: "You can use Visual C++ 2005 Express to build powerful .NET Framework applications immediately after installation. In order to use Visual C++ Express to build Win32 applications, you'll need to take just a few more steps."..., then he continues on to describe how to fix the problem. Try it! It works!
    Tuesday, February 28, 2006 1:46 PM
  • I ran into the same problem as BLACKDOG2.

    I was using a set of functions CreateFile, WriteFile, etc. since they allow me to read & write data in files larger than 2 or 4 GB. Ie: they use 64 rather than 32 bit addressing.

    Are there other functions that allow me to do that which don't require windows.h? If so are there any advantages to those functions over the ones I was using?

    Also I want to write a DLL containing functions in C that can be called from a Visual Basic routine, & these functions would use WriteFile etc. Does Visual Basic have any problems with those windows.h functions?

    Wednesday, July 12, 2006 10:46 PM
  • I got like this:

    Compiling...
    stdafx.cpp
    C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\mfc\afxwin.h(1227) : fatal error C1083: Cannot open include file: 'afxmsg_.h': No such file or directory
    Build log was saved at "file://c:\Documents and Settings\Orang Pemalang\My Documents\Visual Studio 2005\Projects\button\Debug\BuildLog.htm"
    button - 1 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    I cant find '
    afxmsg_.h' in my computer. Help me, please...
    Thursday, July 13, 2006 4:33 AM
  • Visual C++ Express Edition does not support MFC development - if you want to do MFC (or ATL) development you need to get at least the Standard Edition.
    Thursday, July 13, 2006 4:35 PM
  • Jim Baerg, Have you followed all the steps detailed in http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx. Note, that the PSDK link given in step 2 links to an outdated version of the PSDK... use this link instead for a later version (or if you think you're ready... this link).

    Thursday, July 13, 2006 7:00 PM
  • So.... Can't i compile "Visual C++ Sample Applications" in http://msdn2.microsoft.com/en-us/library/1370z17c.aspx ??? I use latest PSDK and try http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx steps. .
    Friday, July 14, 2006 12:50 AM
  • Orang Pemalong.

    Some of those samples you can compile, the others (mostly the ATL/MFC samples) you won't be able to compile. Which sample are you having trouble with?

     

    Friday, July 14, 2006 2:21 PM
  •  

    well, in fact i got the same issue :

    >C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\mfc\afxwin.h(1227) : fatal error C1083: Cannot open include file: 'afxmsg_.h': No such file or directory

    and afxmsg_.h is nowhere to be found on my computer.

    Did you manage to solve this problem ?

     

    Wednesday, February 14, 2007 5:54 PM
  • Did you get solution for this?  I am getting same error when I try to migrate a project form MFC C++ 6.0 to Visual C++ 2005. How to get ride off this?  Should I use a different header file to replace afxwin.h?

     

    Any suggestions would be appreciated.

    Thursday, April 12, 2007 8:16 PM
  •  

    Hi MSFT gurus, it would be greatly appreciated if MFC (or a stripped down version of it) was released with the beta Visual Studio versions. It is very disappointing on such a big company's part to be making money off needs of even non-commercial, sometimes educational developers.

     

    What can you do to support the call for free MFC in addition to just letting us know we need to pay for developing free applications too?

     

    Thank you!

    Saturday, March 8, 2008 10:00 PM