Cannot open Windows.h in Microsoft Visual Studio

后端 未结 7 1518
滥情空心
滥情空心 2020-12-03 06:33

First of all: I\'m using Microsoft Visual Studio 2012

I am a C#/Java developer and I am now trying to program for the kinect using Microsoft SDK and C++. So I starte

相关标签:
7条回答
  • 2020-12-03 07:00

    If you already haven't done it, try adding "SDK Path\Include" to:

    Project → Preferences → C/C++ → General → Additional Include Directories
    

    And add "SDK Path\Lib" to:

    Project → Preferences → Linker → General → Additional Library Directories
    

    Also, try to change "Windows.h" to <windows.h>

    If won't help, check the physical existence of the file, it should be in "\VC\PlatformSDK\Include" folder in your Visual Studio install directory.

    0 讨论(0)
  • 2020-12-03 07:04

    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

    If this is missing, you found a problem. If not, search for a file. It should be located in

    32 bit systems:

    C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include

    64 bit systems:

    C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Include

    if VS was installed in the default directory.

    Source: http://forums.codeguru.com/showthread.php?465935-quot-windows-h-no-such-file-or-directory-quot-in-Visual-Studio-2008!-Help&p=1786039#post1786039

    0 讨论(0)
  • 2020-12-03 07:04

    1) Go to C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A for VS2013

    2) Copy the folders Include and Lib (you should check where are your folders in folder windows such as v7.1, v8, v6, etc.)

    3) Paste them into C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC

    I solved my problems like:

    error lnk1104: cannot open file 'kernel32.lib'.
    error c1083: Cannot open Windows.h

    Thanks.

    0 讨论(0)
  • 2020-12-03 07:06

    I got this error fatal error lnk1104: cannot open file 'kernel32.lib'. this error is getting because there is no path in VC++ directories. To solve this problem

    Open Visual Studio 2008

    1. go to Tools-options-Projects and Solutions-VC++ directories-*
    2. then at right corner select Library files
    3. here you need to add path of kernel132.lib

    In my case It is C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib

    0 讨论(0)
  • 2020-12-03 07:10

    If you are targeting Windows XP (v140_xp), try installing Windows XP Support for C++.

    Starting with Visual Studio 2012, the default toolset (v110) dropped support for Windows XP. As a result, a Windows.h error can occur if your project is targeting Windows XP with the default C++ packages.

    Check which Windows SDK version is specified in your project's Platform Toolset. (Project → Properties → Configuration Properties → General). If your Toolset ends in _xp, you'll need to install XP support.

    Open the Visual Studio Installer and click Modify for your version of Visual Studio. Open the Individual Components tab and scroll down to Compilers, build tools, and runtimes. Near the bottom, check Windows XP support for C++ and click Modify to begin installing.

    See Also:

    • How to target Windows XP in Microsoft Visual Studio C++
    • What's the difference between Platform Toolsets v140 and v140_xp?
    0 讨论(0)
  • 2020-12-03 07:11

    The right combination of Windows SDK Version and Platform Toolset needs to be selected Depends of course what toolset you have currently installed

    0 讨论(0)
提交回复
热议问题