locked
Where's windows.h? RRS feed

  • Question

  • I've just installed VS2015 Community. 

    I didn't uninstall VS2010. 

    It converted a large application I'm currently working on. 

    I'm getting this error - fatal error C1083: Cannot open include file: 'windows.h': No such file or directory

    Here is some new code I just created using the empty template, multi char instead of UTF 16:

    #include <windows.h>
    
    INT_PTR CALLBACK simple_2015_dialog_box(HWND hdlg,
                                            UINT message,
                                            WPARAM wParam,
                                            LPARAM lParam);
    
    int WINAPI WinMain(HINSTANCE hinstance, 
                       HINSTANCE hPrevInstance,
                       PSTR szCmdLine, int iCmdShow)
    {
         DialogBox(hinstance,
                   "SIMPLE_2015_DIALOG", NULL,
                   (DLGPROC)simple_2015_dialog_box);
    }
    
    INT_PTR CALLBACK simple_2015_dialog_box(HWND hdlg,
                                            UINT message,
                                            WPARAM wParam,
                                            LPARAM lParam)
    {
    }

    There might be a lot of problems in this little piece of code, I just tossed it together. I didn't even bother building the dialog template. 

    However, the only error it reports is - fatal error C1083: Cannot open include file: 'windows.h': No such file or directory

    I searched the C drive for windows.h and found nothing. 

    I've found Microsoft's search tool useless since Win 7.  Here is what it came up with when looking for windows.h.

    Why do I need to scroll through 209 files with names like

      amd64_microsoft.windows.c..-controls.resources_6595b64144ccf1df_5.82.10586.0_hu-hu_396d25395bc70435_comctl32.dll.mui_0da4e682

    when I'm searching for a file with the name of "windows.h"?  I've looked for a forum on MS's search feature, with no luck. 

    Anyway, the search finds no file named windows.h. 

    Why can't I find VS2010's windows.h file?

    What am I doing wrong?

    Thanks
    Larry



    Thursday, March 24, 2016 5:34 PM

Answers

  • Check it out under Program Files (x86)\Windows Kits\8.1\Include\um\Windows.h . Add the include path to VS2015 path and then try it again.

    Thanks


    Rupesh Shukla

    • Proposed as answer by Baron Bi Friday, March 25, 2016 6:39 AM
    • Marked as answer by May Wang - MSFT Tuesday, April 5, 2016 3:33 AM
    Thursday, March 24, 2016 6:52 PM

All replies

  • If you accepted  the default options when VS2015 Community was installed then VC++ was NOT included in the installation.  In order to get VC++ it is necessary to do a custom install and check the appropriate boxes.  Run the VS2015 setup program through the control panel applet (e.g., Programs and Features) and see if VC++ is marked as installed.

    Are you building from the command line or from a project within the IDE?

    • Edited by RLWA32 Thursday, March 24, 2016 5:44 PM
    Thursday, March 24, 2016 5:38 PM
  • Thanks RLWA32.

    I chose to install everything, here is the list of features from the setup program under the control panel you suggested:

    Why wouldn't the VS2010's windows.h be found by the search?  Did the install of VS2015 wipe some VS2010 off of the drive?  This isn't a problem once I get VS2015 working, just curious. 

    I appreciate your effort to assist me.

       Larry

    Thursday, March 24, 2016 6:19 PM
  • Check it out under Program Files (x86)\Windows Kits\8.1\Include\um\Windows.h . Add the include path to VS2015 path and then try it again.

    Thanks


    Rupesh Shukla

    • Proposed as answer by Baron Bi Friday, March 25, 2016 6:39 AM
    • Marked as answer by May Wang - MSFT Tuesday, April 5, 2016 3:33 AM
    Thursday, March 24, 2016 6:52 PM
  • Why wouldn't the VS2010's windows.h be found by the search?  Did the install of VS2015 wipe some VS2010 off of the drive?  This isn't a problem once I get VS2015 working, just curious. 

    I appreciate your effort to assist me.

       Larry

    If you want to use VS2010's toolset go into the project property page and change the toolset from v140 to v100(from memory I think that's the one).

    When you installed VS2015 did you do it while logged in as an administrator?

    • Edited by RLWA32 Thursday, March 24, 2016 7:13 PM
    Thursday, March 24, 2016 7:11 PM
  • After creating an VC++ 2015 Win32 project using the Empty project template the default VC++ directories were --

    Include Path -

    C:\Program Files\Microsoft Visual Studio 14.0\VC\include
    C:\Program Files\Microsoft Visual Studio 14.0\VC\atlmfc\include
    C:\Program Files\Windows Kits\10\Include\10.0.10240.0\ucrt
    C:\Program Files\Windows Kits\8.1\Include\um
    C:\Program Files\Windows Kits\8.1\Include\shared
    C:\Program Files\Windows Kits\8.1\Include\winrt

    Library Path -

    C:\Program Files\Microsoft Visual Studio 14.0\VC\lib
    C:\Program Files\Microsoft Visual Studio 14.0\VC\atlmfc\lib
    C:\Program Files\Windows Kits\10\lib\10.0.10240.0\ucrt\x86
    C:\Program Files\Windows Kits\8.1\lib\winv6.3\um\x86
    C:\Program Files\Windows Kits\NETFXSDK\4.6\Lib\um\x86

    Executable Path -

    C:\Program Files\Microsoft Visual Studio 14.0\VC\bin
    C:\Program Files\Windows Kits\8.1\bin\x86
    C:\Program Files\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools
    C:\Program Files\Microsoft Visual Studio 14.0\Common7\Tools\bin
    C:\Program Files\Microsoft Visual Studio 14.0\Common7\tools
    C:\Program Files\Microsoft Visual Studio 14.0\Common7\ide
    C:\Program Files\HTML Help Workshop
    C:\Program Files\MSBuild\14.0\bin\
    C:\Windows\Microsoft.NET\Framework\v4.0.30319\
    C:\Windows\SysWow64
    C:\Windows\system32
    C:\Windows
    C:\Windows\System32\Wbem
    C:\Windows\System32\WindowsPowerShell\v1.0\
    C:\Program Files\Windows Kits\8.1\Windows Performance Toolkit\

    Thursday, March 24, 2016 7:27 PM
  • Thanks Rupesh Shukla:

    That worked.

    Why is it my job to search for the include directories Visual Studio 2015 uses?  Aren't there programs to do these things?

    How about this?

    c:\program files (x86)\windows kits\8.1\include\um\windows.h(1): fatal error C1083: Cannot open include file: 'winapifamily.h': No such file or directory

    I've used Windows Explorer search for winapifamily.h and found nothing.  Of course that's no reason to believe it's not there. 

    I have a lot of folders defined in VS2010's list of include directories, executable directories and similar things.  Is there a method to tell VS2015 to make a copy of these lists without copying the name of each folder?

    While I'm asking, where is the VS2015 executible code?  It doesn't get a shortcut on my desktop when I installed it and I'd like to add one. 

       Thanks
       Larry



    Thursday, March 24, 2016 7:36 PM
  • Why wouldn't the VS2010's windows.h be found by the search?  Did the install of VS2015 wipe some VS2010 off of the drive?  This isn't a problem once I get VS2015 working, just curious. 

    I appreciate your effort to assist me.

       Larry

    If you want to use VS2010's toolset go into the project property page and change the toolset from v140 to v100(from memory I think that's the one).

    When you installed VS2015 did you do it while logged in as an administrator?

    Thanks again RLWA32:

    I have no interest in keeping VS2010 after VS2015 is working. 

    I'd like to keep it usable until VS2015 is functioning properly.

    However, initial attempts to compile applications with VS2010 have been disappointing.  I don't have anything urgent so let's push ahead with VS2015. 

    I was logged in as an administrator when I installed VS2010 on my Win 8.1 system. 

    Larry

    Thursday, March 24, 2016 8:11 PM
  • I have no interest in keeping VS2010 after VS2015 is working. 

    I'd like to keep it usable until VS2015 is functioning properly.

    However, initial attempts to compile applications with VS2010 have been disappointing.  I don't have anything urgent so let's push ahead with VS2015. 

    I was logged in as an administrator when I installed VS2010 on my Win 8.1 system. 


    FYI, the paths listed in my above comment were for an installation of VC++2015 on a 32 bit system.  On a 64 bit system the program files path would be "C:\Program Files (x86).."

    You should be able to build using VS2010's toolset from within VS2015 if you change the Platform Toolset as described above. 

    While the manual addition of a file path (i.e. Program Files (x86)\Windows Kits\8.1\Include\) may have solved the windows.h issue it is symptomatic of a problem with the VS2015 installation.  It should not have been necessary for you to make such a manual addition for one of the default VC++ directories paths.  You might consider using the Property Manager to look at the various default property pages and the content of their VC++ directories properties to make sure that they contain the proper values.

    Thursday, March 24, 2016 8:37 PM
  • For me, running VS2015:

    I'm getting these lists from this window in the project's properties:

    Include Path:

    Release: $(BOOST_ROOT) $(VCInstallDir)include $(VCInstallDir)atlmfc\include $(WindowsSdkDir)include $(FrameworkSDKDir)\include $(UTILITIES_ROOT)\code\windows_files\headers $(UTILITIES_ROOT)\code\unix_files\unix_include Debug: C:\Program Files %28x86%29\Windows Kits\8.1\Include\um
    $(IncludePath)

    The release version refers to header files I want available to every build, under $(UTILITIES_ROOT).

    These have been wiped in the debug configuration.  I did look at the list of include folders in the edit box that pops up while looking at the different configurations, in debug mode. I've been careful, and I don't believe I erased any that would have popped up in the edit box.

    Library Path:

    $(BOOST_ROOT)\stage\lib
    $(VCInstallDir)lib
    $(VCInstallDir)atlmfc\lib
    $(WindowsSdkDir)lib
    $(FrameworkSDKDir)\lib
    

    Executible Path:

    $(VC_IncludePath)
    $(WindowsSDK_IncludePath)
    $(MSBuild_ExecutablePath)
    $(VC_LibraryPath_x86)

    Perhaps I'm not looking at the correct information, but these lists don't seem to match. 

    Thanks again for taking time to help me.

       Larry

    Thursday, March 24, 2016 9:18 PM
  • The paths that I posted above came from the project properties but after I selected Edit from the dropdown. Selecting Edit opens a dialog box that show the actual path strings, not just the VS macro names.  For example, following is what is displayed for the detail of the VC++ Include Path

    Thursday, March 24, 2016 9:31 PM
  • Try Installing VS2015 service Pack 1 and then try again.

    Thanks


    Rupesh Shukla

    Thursday, March 24, 2016 9:47 PM
  • What is this "Program Files 28x86%29" ? Looks suspicious.
    • Edited by Pavel A Thursday, March 24, 2016 9:54 PM
    Thursday, March 24, 2016 9:53 PM
  • What is this "Program Files 28x86%29" ? Looks suspicious.

    %28 is a "(" and %29 is ")"
    Thursday, March 24, 2016 10:02 PM
  • Thanks Rupesh Shukla, RLWA32 and Pavel:

    I've had a long day, and will pick this up tomorrow, US West coast time. 

    I'm very grateful for the effort you are making to help me.

       Larry

    Thursday, March 24, 2016 11:47 PM
  • Hi Again:

       I have confidence we can get VS2015 going on my computer. 

       Because there seems to be something wrong with the VS2015 install, indicated by the fact that I have to tell it where to find windows.h, I've decided to uninstall both VS2015 and VS2010. 

       I see a lot of Microsoft Visual Studio and C run time stuff left behind. 

       Perhaps things will be smoother if I get rid of everything this and previous Visual Studio installs added to my computer. 

       This is a chronological sort of my "Programs and Features" window.  I'd like guidance on what I can remove in order to make VS2015 install smoothly. 

    This is probably from an attempt to re-install VS2010 a week ago.

    And...

    And...

    And FINALLY!

    I recognize a few of these programs as not relating to Visual Studios, but most of them are.  I'm not using Microsoft's SQL server, though other's programs might be. 

    Anyway, I'd like to clean some of these up and then re-install VS2015. 

    Can you let me know what can go, or if it's easier what I should keep?

       Thanks
       Larry


    Friday, March 25, 2016 8:16 PM
  • Larry,

    Visual Studio and it's service packs install so much software that I think it's not advisable to try to cherry pick things to uninstall.  The first thing to do is to make a good backup. You should also consider making an image backup of your system as well as a file based backup.  Good backup is essential when you contemplate making major changes.  I can't stress that enough.

    I think that the cleanest path to follow would be to uninstall all versions of VS completely. 

    However, If you have installed other software (e.g., standalone SDKs) that integrated with Visual Studio I would uninstall that as the first step.  Same for any software that you installed through VS2015's built in facilities to install extensions and other packages.  You can reinstall that software after Visual Studio has itself been reinstalled. 

    After uninstalling any ancillary software that you know you installed on a standalone basis the next step would be to uninstall VS2015 first, followed by VS2010.  At that point you can review what is left on your system and make a determination if anything else should be uninstalled.

    When installing (or reinstalling) multiple versions of VS on a system the recommended procedure is to install the oldest version first and order the installations so that the most recent VS version is the last one installed.

    I recommend that if you follow the uninstall/reinstall method that you install all updates and service packs to VS2010 before moving on to VS2015.

    These are my opinions and there is no guarantee that following this advice will result in a successful outcome.  I suggest you also obtain and consider the recommendations of others before deciding on a course of action.

    Friday, March 25, 2016 9:42 PM
  • Larry,

    Visual Studio and it's service packs install so much software that I think it's not advisable to try to cherry pick things to uninstall.  The first thing to do is to make a good backup. You should also consider making an image backup of your system as well as a file based backup.  Good backup is essential when you contemplate making major changes.  I can't stress that enough.

    I backed everything up before trying to install VS2015

    I think that the cleanest path to follow would be to uninstall all versions of VS completely. 

    I did uninstall both of the Visual Studio versions.

    However, If you have installed other software (e.g., standalone SDKs) that integrated with Visual Studio I would uninstall that as the first step.  Same for any software that you installed through VS2015's built in facilities to install extensions and other packages.  You can reinstall that software after Visual Studio has itself been reinstalled. 

    I haven't installed anything like that.

    After uninstalling any ancillary software that you know you installed on a standalone basis the next step would be to uninstall VS2015 first, followed by VS2010.  At that point you can review what is left on your system and make a determination if anything else should be uninstalled.

    This is the point I'm at right now, and these are the remnants that are left after both have been removed.

    So the question is, of the software you see in these lists, what do I uninstall?

    I'd like to clean it out as much as I can.

    Then I'll install VS2015 again.

    When installing (or reinstalling) multiple versions of VS on a system the recommended procedure is to install the oldest version first and order the installations so that the most recent VS version is the last one installed.

    I have no interest in having anything but VS2015 on my system.

    I recommend that if you follow the uninstall/reinstall method that you install all updates and service packs to VS2010 before moving on to VS2015.

    These are my opinions and there is no guarantee that following this advice will result in a successful outcome.  I suggest you also obtain and consider the recommendations of others before deciding on a course of action.

          Thanks again
          Larry

    Saturday, March 26, 2016 1:04 AM
  • Larry,

    If I understand correctly you are saying that the screen shots in the earlier post reflect the state of your system after uninstalling VS2015 and VS2010.  If so, I agree with your observation that a lot of software was left behind by that process. In reviewing the list of  installed software I would consider any item as a candidate to be removed if you had not taken explicit action in the past to install it on a standalone basis.


    You may want to leave any vc++ redistributable packages alone since you don't know what software may be dependent on them
    • Edited by RLWA32 Saturday, March 26, 2016 1:39 AM
    Saturday, March 26, 2016 1:33 AM
  • I also encountered this issue after upgrading from VS 2015 to VS 2017. The problem for me was the "Windows SDK Version" set in the project settings was no longer available because it was upgraded to v10. Of course, if you want it to still work with that Windows SDK version you can install it.

    Saturday, March 18, 2017 4:57 PM
  • the solution is here. You need to install 10.0.15063.0 version update, using the installer, and selecting modify.

    https://stackoverflow.com/questions/43410631/visual-studio-2017-cant-find-windows-h

    Wednesday, May 16, 2018 6:29 PM