15

Just installed visual studio 2019 on windows 10, was using visual studio for the first time and ran into the following error, It's a basic hello world console program that I tried to run.

error C1083: Cannot open include file: 'corecrt.h': No such file or directory
1>Done building project "ConsoleApplication2.vcxproj" -- FAILED.

Severity Code Description Project File Line Suppression State Warning MSB8003 The WindowsSDKDir property is not defined. Some build tools may not be found. ConsoleApplication2 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets 434

I tried searching for this error over YouTube and of course here, and also Microsoft's offical forum but couldn't find anything.

#include <iostream>
using namespace std;
int main()
{
    cout << "Hello World!\n";
}

the code looks just fine.

Pawan Nirpal
  • 565
  • 1
  • 12
  • 29
  • Based on the error you're facing this `MSB8003 The WindowsSDKDir property is not defined` looks like WindowsSDKDir path is not defined in IDE, please take a look at this, https://stackoverflow.com/q/22188919/5928015 – Vipertecpro Jul 13 '19 at 14:37
  • https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk/ download SDK from the above link it will solve your problem. – GOWTHAM Apr 20 '21 at 18:06

5 Answers5

26

I ran into the same issue today. It turns out I didn't check the Win10SDK to save disk space while installation.

Solution:

In VS, go Tools menu=>Get Tools and Features=>install the Windows 10 SDK(10.XX.XX.XX)

Once installed, launch VS and open your project, right-click your project(NOT Solution)->properties->General->Windows SDK Version, check the value should be 10.0 instead of blank. Then the compiling just worked.

Frank Miller
  • 376
  • 3
  • 5
  • 3
    Thanks for this. It's a bit bad given it was an optional module? And why do I need Win10 if I'm running Win7? – user997112 Jun 16 '20 at 13:07
  • Yes, it'll be a good idea if that is a required module or give some warning when you deselect it. I guess all the windows version SDK have merged to Windows 10 SDK. – Frank Miller Mar 04 '21 at 06:43
5

I've got the same issue and turned out that I haven't installed Windows SDK. It can be done by typing "Install Windows SDK" into visual studio's search prompt

Borys Petrov
  • 51
  • 1
  • 1
4

I had same problem when I installed Visual Studio 2019 on Windows7 and opened project created in Visual Studio 2017 (witch wasn't installed on that machine). To solve the problem I went to project Properties -> General -> Windows SDK Version And changed it from 10 to 8.1.

LovelyHanibal
  • 317
  • 2
  • 13
1

I fixed this issue by repairing Windows SDK. Now it's working as expected.


Steps:

  1. Go to Settings>Apps & Features.
  2. Click on Windows Software Development Kit - Windows 10.0.18362.1 (Note: Version number might be different for you)
  3. Click on Modify.
  4. Select Repair from options.
  5. Click Next.
  6. Restart VS and try running your project.
Omkar76
  • 1,317
  • 1
  • 8
  • 22
0

I was just having thesame issue so I figured maybe the headers were in a different directory than where the program is searching. When I went looking for tge header files none existed. So the problem is probably with iostream not existing.

peves
  • 9
  • 1
  • Welcome to StackOverflow! It does not look like your answer provides any solution. If you have working recipe to resolve such issue then please edit your post and add extra information. – Maxim Sagaydachny Feb 19 '20 at 18:52