admin管理员组文章数量:1405140
I have created a simple C++ console application for Windows in Visual Studio 2019 and I want it to be able to run on Windows 8 (not 8.1) machines.
I have downloaded and installed the Windows 8 SDK from Microsoft's Windows SDK Archive. I can see it is clearly installed alongside the 8.1 and 10 SDKs:
Now when I go to my project properties in Visual Studio, I don't have the option to select the Windows 8 SDK:
I tried to manually enter "8.0" in the Windows SDK version and then point everything to the Windows 8 SDK directories:
But when compiling I get:
Error (active) E1696 cannot open source file "stddef.h"
Error (active) E1696 cannot open source file "stdio.h"
Error (active) E1696 cannot open source file "math.h"
(...lots of similar errors...)
Error MSB8036 The Windows SDK version 8.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 have created a simple C++ console application for Windows in Visual Studio 2019 and I want it to be able to run on Windows 8 (not 8.1) machines.
I have downloaded and installed the Windows 8 SDK from Microsoft's Windows SDK Archive. I can see it is clearly installed alongside the 8.1 and 10 SDKs:
Now when I go to my project properties in Visual Studio, I don't have the option to select the Windows 8 SDK:
I tried to manually enter "8.0" in the Windows SDK version and then point everything to the Windows 8 SDK directories:
But when compiling I get:
Error (active) E1696 cannot open source file "stddef.h"
Error (active) E1696 cannot open source file "stdio.h"
Error (active) E1696 cannot open source file "math.h"
(...lots of similar errors...)
Error MSB8036 The Windows SDK version 8.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".
Share
asked Mar 8 at 20:41
cdontscdonts
9,6415 gold badges52 silver badges78 bronze badges
5
- 1 You probably don't need to, anything built with the current visual studio will work down to windows 7 unless you're explicitly using windows 10+ features – Alan Birtles Commented Mar 8 at 20:50
- it doesn't matter what version of SDK you use. you can use the latest version of SDK when compiling and linking, and still run the code on xp. it only matters what api. you use. if you want the code to work on win8 you should use only the api available on this version. the version of the sdk doesn't matter (if it's not too old) – RbMm Commented Mar 8 at 20:51
- @RbMm the standard vs toolset doesn't support xp – Alan Birtles Commented Mar 8 at 21:03
- @AlanBirtles RbMm You were right. Should have tested the app before asking. Thanks – cdonts Commented Mar 8 at 21:21
- @AlanBirtles support. I can without any problem build exe/dll with latest sdk/vs toolset and it will be run on xp. Note that i say about sdk but not crt – RbMm Commented Mar 8 at 22:16
1 Answer
Reset to default 3You don't need to install old Windows SDKs. It's good enough to have the latest one installed that supports targets since Windows 7.
Instead of selecting a Windows SDK Version, you should specify the target platform with macros in C/C++ -> Preprocessor:
WINVER=0x0602
_WIN32_WINNT=0x0602
When you use the Windows SDK, you can specify which versions of Windows your code can run on. The preprocessor macros
WINVER
and_WIN32_WINNT
specify the minimum operating system version your code supports. Visual Studio and the Microsoft C++ compiler support targeting Windows 7 SP1 and later.
本文标签: cHow can I target Windows 8 (not 81) with Visual Studio 2019Stack Overflow
版权声明:本文标题:c++ - How can I target Windows 8 (not 8.1) with Visual Studio 2019? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744885469a2630458.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论