0

For the past hour I have been looking at multiple stack overflow questions trying including this one and this one trying to figure out why visual studio cannot open typical source files like stdio.h

I am starting out by building a new project and then selecting the "console app" option, but when I try to compile and run the simple hello world program I get the errors shown below.

enter image description here

Edit:

Here is the code that is generated by default when choosing the console application option in visual studio that I am trying to run:

#include <iostream>

int main()
{
    std::cout << "Hello World!\n";
}
knowledge_seeker
  • 811
  • 1
  • 8
  • 18
  • 1
    Can you show the actual code? "Simple hello world program" doesn't tell us much. Also, do any of the steps in [this](https://stackoverflow.com/questions/42777424/visual-studio-2017-errors-on-standard-headers) question help? – Nathan Pierson May 06 '21 at 23:51
  • I have now edited the question with the code. It is the default code that is generated by visual studio. – knowledge_seeker May 06 '21 at 23:55

1 Answers1

0

The issue was that I thought I had the Widows 10 SDK installed, but apparently I did not. I found the answer using this stack overflow thread.

I had to download the Windows 10 SDK from here and restart the visual studio IDE and it worked straight away.

knowledge_seeker
  • 811
  • 1
  • 8
  • 18
  • I fear you installed things incorrectly originally and may have made it worse. You do not need to install the Windows 10 SDK from anywhere other than through the Visual Studio installer. By Selecting the "Desktop C++ Development" workload the SDK is installed for you. – Casey May 07 '21 at 00:16
  • What do you suggest I do now? Should I uninstall visual studio and reinstall it ensuring that I install the "Desktop C++ Development"? – knowledge_seeker May 07 '21 at 00:23
  • 1
    You lucked out that the install directions say you can use either method, but in the future you can do everything through the VS Installer; especially for SDK and VS updates. – Casey May 07 '21 at 00:30
  • @user13834264 I am glad you have got your solution and thanks for your sharing, I would appreciate it if you mark them as answer and this will be beneficial to other community. – Jeaninez - MSFT May 12 '21 at 07:06