Windows h cannot open include file

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 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

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

Epic Developer Community Forums

Loading

  • Remove From My Forums
  • Question

  • Hello,

    I have tried using pcl 1.8.0 based program with studio 2015.

    I produced the solution file successfully using Cmake 3.6.1.

    However I am getting the follwing error while building solution

    1083 Cannot open include file: ‘windows.h’: No such file or directory
    pcl_visualizer_demo C:\Program Files\PCL 1.8.0\include\pcl-1.8\pcl\io\impl\pcd_io.hpp

    I have also posted on pcl users community for the same.

    look at http://www.pcl-users.org/Visual-studio-2015-build-error-Cannot-open-include-file-windows-h-tt4042551.html.

    I updated the studio sdk too. but I am unable to succeed please help.

    Thanks in advance.

I’m trying to get IKVM to build (see this question) but now have encountered a problem not having to do with IKVM so I’m opening up a new question:

When running nant on the IKVM directory with the Visual Studio 2008 Command Prompt (from the Start Menu), I get the following error:

        ikvm-native-win32:

               [cl] Compiling 2 files to C:\ikvm-0.36.0.11\native\Release'.

               [cl] jni.c
               [cl] os.c
               [cl] C:\ikvm-0.36.0.11\native\os.c(25) : fatal error C1083: Cannot open include file: 'windows.h': No such
                    file or directory
               [cl] Generating Code...

        BUILD FAILED

        C:\ikvm-0.36.0.11\native\native.build(17,10):
        External Program Failed: cl (return code was 2)

I have the Platform SDK installed. What am I missing? I’m sure it’s something simple…

Edit #1 I just checked — I do have the directory containing windows.h on the Path.
Edit #2 Found the answer (see my answer below): The directory containing windows.h needed to be in the «Include» path variable.

user avatar

asked Sep 17, 2008 at 7:25

user avatar

1

OK here is the answer I ended up finding: rather than being on the Path, the directory with windows.h (in my case, C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include) needed to be set in the Include environment variable.

answered Sep 17, 2008 at 8:48

user avatar

EpagaEpaga

37k58 gold badges154 silver badges243 bronze badges

3

By the way, create environment variable %LIB%, meaning the same — path to all SDKs lib directories

answered Jan 15, 2009 at 13:08

user avatar

abatishchevabatishchev

95.4k80 gold badges293 silver badges426 bronze badges

Not the answer you’re looking for? Browse other questions tagged c# .net path ikvm or ask your own question.

Цитата
Сообщение от ATAMAN200
Посмотреть сообщение

наскоко мне память не изменяет Visul C++ 2005 Express Editional это не полная версия просто в ней отсутствует инклуд windows.h
Добавлено через 2 минуты
для полной разработки приложений тебе надо Visul C++ 2005 Profissional Editional

Да ну?!!

MACCOP, создаёте новый проект, выбираете «консольное приложение Win 32», обзываете его как-нибудь (к примеру HelloMessage), жмёте кнопку «готово» — в редактор загружается файл HelloMessage.cpp примерно такого содержания:

C++
1
2
3
4
5
6
7
8
9
10
// HelloMessage.cpp: определяет точку входа для консольного приложения.
//
 
#include "stdafx.h"
 
 
int _tmain(int argc, _TCHAR* argv[])
{
    return 0;
}

слева от него есть окно «обозреватель решений», в котором в папке «заголовочные файлы» значится stdafx.h — щёлкаете по нему два раза — он загружается в редактор и вот там добавляете windows.h

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// stdafx.h: включаемый файл для стандартных системных включаемых файлов
// или включаемых файлов для конкретного проекта, которые часто используются, но
// не часто изменяются
//
 
#pragma once
 
#include "targetver.h"
 
#include <stdio.h>
#include <tchar.h>
 
// TODO: Установите здесь ссылки на дополнительные заголовки, требующиеся для программы
#include <Windows.h>

после чего в HelloMessage.cpp перед return 0; вставляете строку

C++
1
MessageBoxA(NULL, "Hello world!", "Greeting", MB_OK);

запускаете, наблюдаете вот такую картинку
Название: hello.png
Просмотров: 2367

Размер: 2.5 Кб

  • Windows h c графика в консоли
  • Windows game launcher windows 7
  • Windows forms ссылка на объект не указывает на экземпляр объекта
  • Windows gui version of fat32format
  • Windows game explorer windows 10