无法在Microsoft Visual Studio中打开Windows.h [英] Cannot open Windows.h in Microsoft Visual Studio

查看:221
本文介绍了无法在Microsoft Visual Studio中打开Windows.h的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先:我正在使用Microsoft Visual Studio 2012

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

我是C#/Java开发人员,现在我正尝试使用Microsoft SDK和C ++为kinect编程.因此,我从Color Basics示例开始,但无法对其进行编译. 最初,没有一个类能够找到Windows.h.因此,我安装了Windows SDK(或不确定,是否重新安装了),并将SDK的include目录添加到项目的include路径"中.然后所有的问题都消失了,除了一个:

I am a C#/Java developer and I am now trying to program for the kinect using Microsoft SDK and C++. So I started of with the Color Basics example, and I can not get it to compile. At first, none of the classes were able to find Windows.h. So I installed (Or re-installed, I'm not sure) the Windows SDK, and added the include dir of the SDK to the include "path" of the project. Then all the problems were gone, except for one:

Error   5   error RC1015: cannot open include file 'windows.h'. C:\temp\ColorBasics-D2D\ColorBasics.rc  17  1   ColorBasics-D2D

多数民众赞成在错误.没有任何理由,系统可以找到它,因为它已在多个其他文件中使用,只有该文件无法使用.作为参考,正在窃听的整个文件(ColorBasics.rc):

And thats the error. No reasons why, the system can find it because it is used in multiple other files, only this file is not able to work with it. As a reference, the entire file that is bugging (ColorBasics.rc):

//------------------------------------------------------------------------------
// <copyright file="ColorBasics-D3D.rc" company="Microsoft">
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
//------------------------------------------------------------------------------

// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (United States) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_APP                 ICON                    "app.ico"

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_APP DIALOGEX 0, 0, 512, 424
STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTROLPARENT | WS_EX_APPWINDOW
CAPTION "Color Basics"
CLASS "ColorBasicsAppDlgWndClass"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
    DEFPUSHBUTTON   "Screenshot",IDC_BUTTON_SCREENSHOT,238,391,50,14
    CONTROL         "",IDC_VIDEOVIEW,"Static",SS_BLACKFRAME,0,0,512,384
    LTEXT           "Press 'Screenshot' to save a screenshot to your 'My Pictures' directory.",IDC_STATUS,0,413,511,11,SS_SUNKEN,WS_EX_CLIENTEDGE
END


/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
    IDD_APP, DIALOG
    BEGIN
    END
END
#endif    // APSTUDIO_INVOKED


#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE 
BEGIN
    "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
    "#include ""windows.h""\r\n"
    "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
    "\0"
END

3 TEXTINCLUDE 
BEGIN
    "\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED

#endif    // English (United States) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED

推荐答案

如果尚未完成操作,请尝试将"SDK Path\Include"添加到:

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

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

并将"SDK Path\Lib"添加到:

Project → Preferences → Linker → General → Additional Library Directories

此外,尝试将"Windows.h"更改为<windows.h>

如果无法解决问题,请检查文件的物理存在情况,该文件应位于Visual Studio安装目录的"\ VC \ PlatformSDK \ Include"文件夹中.

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.

这篇关于无法在Microsoft Visual Studio中打开Windows.h的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆