无法打开Windows.h [英] Cannot open Windows.h
问题描述
首先:我使用Microsoft Visual Studio 2012
First of all: I'm using Microsoft Visual Studio 2012
我是一个C#/ Java开发人员,我现在正试图使用Microsoft SDK和C ++。所以我开始与颜色基础的例子,我不能得到它编译。
首先,没有一个类能够找到Windows.h。所以我安装(或重新安装,我不确定)Windows SDK,并添加了SDK的include dir到项目的路径包括。然后所有的问题都消失了,除了一个:
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
这是错误。没有理由,系统可以找到它,因为它用于多个其他文件,只有这个文件是无法使用它。作为参考,整个文件是bugging(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
推荐答案
尝试添加到
Project-> References-> C / C ++ - > General->附加包含目录
Project->References->C/C++->General->Additional Include Directories
SDK路径\包括
和
Project-> References-> - >常规 - >其他库目录
Project->References->Linker->General->Additional Library Directories
SDK Path\Lib
"SDK Path\Lib"
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.
这篇关于无法打开Windows.h的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!