Cannot open source file windows h

Не удается открыть Windows.h в Microsoft Visual Studio

Прежде всего: я использую Microsoft Visual Studio 2012

Я разработчик на C # / Java и сейчас пытаюсь программировать для kinect, используя Microsoft SDK и C ++. Итак, я начал с примера Основы цвета, и я не могу заставить его скомпилировать.
Сначала ни один из классов не смог найти Windows.h. Поэтому я установил (или переустановил, я не уверен) Windows SDK и добавил каталог включения SDK во включаемый «путь» проекта. Тогда все проблемы исчезли, кроме одной:

И это ошибка. Нет причин, по которым система может найти его, потому что он используется в нескольких других файлах, только этот файл не может с ним работать. В качестве ссылки, весь файл, который содержит ошибки (ColorBasics.rc):

Решение

Если вы этого еще не сделали, попробуйте добавить «SDK Path\Include» чтобы:

И добавить «SDK Path\Lib» чтобы:

Также попробуйте поменять «Windows.h» в

Если это не поможет, проверьте физическое существование файла, он должен находиться в папке «\ VC \ PlatformSDK \ Include» в каталоге установки Visual Studio.

Другие решения

Запустите Visual Studio. Перейдите в Инструменты-> Параметры и разверните Проекты и решения.
Выберите каталоги VC ++ из дерева и выберите «Включить файлы» в комбинированном списке справа.

Тебе следует увидеть:

Если этого не хватает, вы нашли проблему. Если нет, найдите файл. Он должен быть расположен в

C: \ Program Files \ Microsoft SDKs \ Windows \ v6.0A \ Включить

C: \ Program Files (x86) \ Microsoft SDKs \ Windows \ v6.0A \ Включить

если VS был установлен в каталог по умолчанию.

Если вы ориентируетесь на Windows XP ( v140_xp ), попробуйте установить Поддержка Windows XP для C ++.

Начиная с Visual Studio 2012, набор инструментов по умолчанию (v110) прекратил поддержку Windows XP. В результате Windows.h ошибка может возникнуть, если ваш проект ориентирован на Windows XP с пакетами C ++ по умолчанию.

Проверьте, какая версия Windows SDK указана в вашем проекте Набор инструментов платформы. ( Project → Properties → Configuration Properties → General ). Если ваш Toolset заканчивается _xp Вам нужно будет установить поддержку XP.

Откройте установщик Visual Studio и нажмите изменять для вашей версии Visual Studio. Открой Отдельные компоненты вкладка и прокрутите вниз до Компиляторы, инструменты сборки и среды выполнения. Около дна, проверьте Поддержка Windows XP для C ++ и нажмите изменять начать установку.

Читайте также:  Spark ar player для windows

Смотрите также:

Я получил эту ошибку фатальная ошибка lnk1104: не могу открыть файл ‘kernel32.lib’. эта ошибка возникает из-за отсутствия пути в каталогах VC ++. Для решения этой проблемы

Откройте Visual Studio 2008

В моем случае это C: \ Program Files \ Microsoft SDKs \ Windows \ v6.0A \ Lib

Источник

Cannot open Windows.h in Microsoft Visual Studio

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:

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

7 Answers 7

If you already haven’t done it, try adding «SDK Path\Include» to:

And add «SDK Path\Lib» to:

Also, try to change «Windows.h» to

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.

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.

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

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

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

if VS was installed in the default directory.

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.

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.

Источник

cannot open source file «stddef.h» (dependency of «stdio.h») #3279

Comments

MlNAT0 commented Mar 12, 2019

I Am Using VS Code with following config.
Version: 1.32.1 (user setup)
Commit: 05f146c7a8f7f78e80261aa3b2a2e642586f9eb3
Date: 2019-03-08T00:51:49.278Z
Electron: 3.1.3
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.17763

When I open Terminal for running my c program it shows me the following problem
«cannot open source file «stddef.h» (dependency of «stdio.h»)»

My c_cpp_properties.json looks something like this ::

<
«configurations»: [
<
«name»: «Win32»,
«includePath»: [
«$/**»,
«C:\MinGW\include»,
«C:\MinGW\lib\gcc\mingw32\8.2.0\include»
],
«defines»: [
«_DEBUG»,
«UNICODE»,
«_UNICODE»
],
«compilerPath»: «C:\MinGW\bin\gcc.exe»,
«cStandard»: «c11»,
«cppStandard»: «c++17»,
«intelliSenseMode»: «clang-x64»
>
],
«version»: 4
>

Читайте также:  Windows 7 ultimate x64 torrent windows

The text was updated successfully, but these errors were encountered:

bobbrow commented Mar 12, 2019

A few issues I see with this config:

Give that a try and let me know how it goes.

MlNAT0 commented Mar 13, 2019

Here Is My New Config Now.

Also I have no errors g++ command

bobbrow commented Mar 13, 2019 •

What I’m really looking for in the log is stuff related to these lines (and if there are any errors nearby):

MlNAT0 commented Mar 14, 2019

0 include path suggestion(s) discovered.
0 include path suggestion(s) discovered.
Checking for syntax errors: file:///c%3A/MinGW/include/stdio.h
0 include path suggestion(s) discovered.
0 include path suggestion(s) discovered.
1 include path suggestion(s) discovered.
1 include path suggestion(s) discovered.
0 include path suggestion(s) discovered.
IntelliSense Engine = Default.
The extension will use the Tag Parser for IntelliSense when #includes don’t resolve.
Autocomplete is enabled.
Error squiggles are enabled.
Shutting down IntelliSense server: C:\USERS\DELL\DESKTOP\C PROGRAMMING\HELLOWORLD.C
Checking for syntax errors: file:///c%3A/MinGW/include/stdio.h
Tag Parser will be used for IntelliSense operations in: file:///c%3A/MinGW/include/stdio.h
1 include path suggestion(s) discovered.
0 include path suggestion(s) discovered.
0 include path suggestion(s) discovered.
0 include path suggestion(s) discovered.
Checking for syntax errors: file:///c%3A/Users/DELL/Desktop/C%20Programming/helloworld.c
Shutting down IntelliSense server: C:\MINGW\INCLUDE\STDIO.H
IntelliSense Engine = Default.
The extension will use the Tag Parser for IntelliSense when #includes don’t resolve.
Autocomplete is enabled.
Error squiggles are enabled.

bobbrow commented Mar 14, 2019

Can you reload the window and try again? I need some of the logs that are only printed at the beginning of the session. Thank you!

MlNAT0 commented Mar 15, 2019

bobbrow commented Mar 15, 2019

Which MinGW do you have? The one from mingw.org (which looks like the one you’re using) seems to be locked at GCC 6.3. How did you get GCC 8.2 with MinGW?

MlNAT0 commented Mar 17, 2019

So should I get GCC 6.3

MlNAT0 commented Mar 17, 2019

I downloaded it from mingw.org

MlNAT0 commented Mar 17, 2019

PROBLEM SOLVED.

Installed Basic Package ::

Added includePath as ::

Now I can Compile And Run My Progams. Thank You

Источник

I am trying to Build a Solution on Visual Studio Community 2017, but I keep getting the error «Cannot open include file: ‘stdio.h’ «. I’ve read through several similar questions, but still can’t fix this problem. Looks like the stdio.h file is called in the stdafx.h file. Below are more details. Any suggestions? (I can’t embed images yet, so please click on the links for screenshots.)

System details: Windows 10
Visual Studio Community 2017 v.15.2 (26430.6)
— Installed Desktop Development with C++ (Screenshot: Installation list)

Step 1: I wrote the famous Hello World program in C++.

Step 2: I clicked on Build > Build Solution.

Problem: ‘stdio.h’: No such file or directory. Full Error:

Troubleshooting details/Things I’ve tried:

Code in stdafx.cpp file:

Code in stdafx.h file:

NOTE: the #include for and both have the red squiggle line underneath, and says «cannot open source file».
TRIED: I tried removing the last two lines, but then I got more errors.

Читайте также:  Windows 10 разрешение экрана горячие клавиши

12 Answers 12

Got same problem with project porting from VS2013 to VS2017,
Fix: change «Properties->General->Windows SDK Version» to 10

Faced the problem of missing stdlib.h and stdio.h (and maybe more) after installing VS2017 Community on a new computer and migrating a solution from VS2013 to VS2017.

Used @Maxim Akristiniy’s proposal, but still got error message regarding toolset compatibility. However VS itself suggested to do solution retarget by right-clicking on the solution in Solution Explorer, then selecting Retarget solution from the menu and the updated Windows SDK Version from the drop-down list.

Now my projects build w/o a problem.

Note that you may need to make the project your startup project for the retargeting to catch.

There are three ways to solve this issue.

Reinstall Visual Studio
This also worked for me, because I realized that maybe there was something wrong with my Windows SDK. I was using Windows 10, but with Windows SDK 8.1. You may have this problem as well.
Steps: Open Visual Studio Installer > Click on the three-lined Menu Bar > Uninstall > Restart your computer > Open Visual Studio Installer > Install what you want, but make sure you install only the latest Windows SDK 10, not multiple ones nor the 8.1.

The first time I installed Visual Studio, I would get an error stating that I needed to install Windows SDK 8.1. So I did, through Visual Studio Installer’s Modify option. Perhaps this was a problem because I was installed it after Visual Studio was already installed, or because I needed SDK 10 instead. Just to be safe I did a complete reinstall.

Источник

cannot open source file «corecrt.h» (dependency of «iostream») #1237

Comments

Hanano-Yuuki commented Nov 11, 2017 •

<
«name»: «Win32»,
«includePath»: [
«C:/VS2015/VC/include/«,
«C:/VS2015/VC/atlmfc/include/
«,
«C:/Program Files (x86)/Windows Kits/8.1/Include/um»,
«C:/Program Files (x86)/Windows Kits/8.1/Include/shared»,
«C:/Program Files (x86)/Windows Kits/8.1/Include/winrt»,
«$»
],
«defines»: [
«_DEBUG»,
«UNICODE»
],
«intelliSenseMode»: «msvc-x64»,
«browse»: <
«path»: [
«C:/VS2015/VC/include/«,
«C:/VS2015/VC/atlmfc/include/
«,
«C:/Program Files (x86)/Windows Kits/8.1/Include/um»,
«C:/Program Files (x86)/Windows Kits/8.1/Include/shared»,
«C:/Program Files (x86)/Windows Kits/8.1/Include/winrt»,
«$»
],
«limitSymbolsToIncludedHeaders»: true,
«databaseFilename»: «»
>
>

The text was updated successfully, but these errors were encountered:

Hanano-Yuuki commented Nov 12, 2017

the problem is solved,sorry for trouble caused

Zeta-lime commented Nov 15, 2017

Hanano-Yuuki commented Nov 15, 2017

zjplab commented Feb 3, 2018

You fixed this problem by changing to gcc as the compiler. For someone choosing MSVC, I fixed the «cannot open source file «corecrt.h» (dependency of «iostream»)» issue by changing the include path in c_cpp_properties.json

«D:/Program Files/Microsoft/MSVC2017/VC/Tools/MSVC/14.12.25827/include/*»,
«C:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt»,
«C:/Program Files (x86)/Windows Kits/10/Lib/10.0.10240.0/ucrt/x64»,

I installed MSVC on D: drive, you may change that according.

hudsontek commented Jul 5, 2019

You fixed this problem by changing to gcc as the compiler. For someone choosing MSVC, I fixed the «cannot open source file «corecrt.h» (dependency of «iostream»)» issue by changing the include path in c_cpp_properties.json

«D:/Program Files/Microsoft/MSVC2017/VC/Tools/MSVC/14.12.25827/include/*»,
«C:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt»,
«C:/Program Files (x86)/Windows Kits/10/Lib/10.0.10240.0/ucrt/x64»,

I installed MSVC on D: drive, you may change that according.

The last line does the job. You can omit the rest lines safely.

Источник

Поделиться с друзьями
Советы экспертов и специалистов
Adblock
detector