skip to Main Content

I am new to C++ and have encountered the following difficulty. I have installed Visual Studio Community 2022 version 17.9.6, in it I have installed the items shown in the screenshot.

enter image description here

Immediately after creating a console application for Windows in C++, I got a lot of errors in the console related to importing files like ‘ctype.h’, ‘errno.h’, ‘float.h’ and so on. I started looking for solutions, but none of them helped me.

Some of what I tried:

  • change Properties → General → Windows SDK Version to 10 (I’ve got 10.0 selected by default)
  • install the "Windows Universal CRT SDK" Visual Studio component

I would be very grateful for the help!

P.S

Screenshot with C++ part
enter image description here

The code i’m using

#include <iostream>

int main()
{
    std::cout << "Hello World!n";
}

Project properties page
enter image description here

Errors:

cannot open source file "ctype.h"
cannot open source file "errno.h"
cannot open source file "float.h"
cannot open source file "locale.h"
cannot open source file "corecrt.h"
cannot open source file "stddef.h"
cannot open source file "stdio.h"
cannot open source file "math.h"
cannot open source file "stdlib.h"
cannot open source file "string.h"
cannot open source file "time.h"
cannot open source file "wchar.h"
cannot open source file "corecrt_terminate.h"
cannot open source file "malloc.h"
cannot open source file "share.h"
cannot open source file "crtdbg.h"
the global scope has no "isalnum"
the global scope has no "isalpha"
the global scope has no "iscntrl"
the global scope has no "isdigit"
the global scope has no "isgraph"
the global scope has no "islower"
the global scope has no "isprint"
the global scope has no "ispunct"
the global scope has no "isspace"
the global scope has no "isupper"
the global scope has no "isxdigit"
the global scope has no "tolower"
the global scope has no "toupper"
the global scope has no "isblank"
the global scope has no "Iconv"
the global scope has no "localeconv"
the global scope has no "setlocale"
the global scope has no "acosf"
the global scope has no "asinf"
the global scope has no "atanf"
the global scope has no "atan2f"
the global scope has no "ceilf"
the global scope has no "cosf"
...

And one more error after trying to change SDK version to 10.0.22621.0: ‘Error MSB8036 The Windows SDK version 10.0.22621.0 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution".’

I would like to add that this version is installed in Visual Studio Installer and I have tried reinstalling it. But as I understood, this SDK should be stored in the path ‘C:Program Files (x86)Windows Kits’, but there are only directories ‘8.1’ and ‘NETFXSDK’ there. Maybe these are some old versions and I need to reinstall Visual Studio completely and delete all the old files?

P.S.2

I uninstalled the Windows 11 SDK (10.0.22621.0) and installed the Windows 10 SDK (10.0.20348.0) (I have Windows 11 installed). A bunch of errors disappeared, the required version started showing up in the project settings. I selected it, but then i got an error: ‘MSB8036 The Windows SDK version 10.0.20348.0 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting ‘Retarget solution”. I don’t understand how this can happen if Visual Studio itself offers me to select this version.

2

Answers


  1. Chosen as BEST ANSWER

    I was able to solve this problem thanks to your help. First, I uninstalled Visual Studio and all versions of Windows Software Development Kit via Installed Apps. After that I installed Visual Studio, selected only "Desktop development with C++" and unchecked Windows SDK installation. After that I manually installed the Windows SDK from the link. Then I was able to open the project and everything works. At the same time, I have "10.0 (latest installed version)" in the project settings.


Please signup or login to give your own answer.
Back To Top
Search