Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'Windows.h: No such file or directory" error when changing Platform Toolset to v140_xp [duplicate]

I tried to compile an application for Windows XP; the normal executable gives the error:

"... is not a valid Win32 application."

I read that I could create an XP-compatible executable by changing the Platform Toolset to Visual Studio 2015 - Windows XP (v140_xp), but when I do that and then try to compile it gives me the following errors:

Cannot open include file: 'Windows.h': No such file or directory

Could not find WindowsSdkDir_71A variable from registry. TargetFrameWorkVersion or Platform toolset may be set to an invalid version number.

How can I compile with this toolset version?

like image 986
Bart Avatar asked Oct 09 '15 09:10

Bart


People also ask

How do you fix window h?

h'". That problem happens because the file, which is needed to compile programs that make calls to the Windows operating system, is not installed. To fix this, download and install the Microsoft Windows SDK for your system (it is free). Once the SDK is installed, add the file paths to Visual Studio.

What is #include Windows H?

h is a Windows-specific header file for the C and C++ programming languages which contains declarations for all of the functions in the Windows API, all the common macros used by Windows programmers, and all the data types used by the various functions and subsystems.

Is Visual Studio compatible with Windows XP?

The toolset supplied in Visual Studio 2019 and later doesn't include support for creating code for Windows XP. Support for Windows XP development is available by using the Visual Studio 2017 v141_xp toolset. You can install the v141_xp toolset as an individual component option in the Visual Studio Installer.


1 Answers

After setting the Platform Toolset to Visual Studio 2015 - Windows XP (v140_xp), you close VS 2015 and reopen your project. It will automatically give a pop up that will tell you to install some files for supporting Windows XP projects.

like image 138
Bart Avatar answered Oct 16 '22 15:10

Bart