What's the difference between the Platform Toolsets ending in _xp and those that don't. (For example, v140 vs v140_xp)
Why aren't there toolsets ending with _vista or _7? When I compile a program on Windows 7 with the v140 toolset, will it run on Windows XP/Vista?
Starting with Visual Studio 2012 its default toolset (v110) didn't support Windows XP anymore. So you were only able to create programs for Windows Vista und newer.
The Visual Studio developers got many protest from the users, because the users have their own customers, which were still using Windows XP.
So the Visual Studio developers introduced v110_xp in Visual Studio 2012 Update 4, which also supports Windows XP.
With all later Visual Studio versions (2013 -> v120, 2015 -> v140) they continued this approach, so you have an extra toolset for Windows XP and newer (v120_xp and v140_xp).
If you create programs, which shall only be used on Windows Vista or newer, then you should use the default toolset (without the _xp suffix). But if you need your programs to run under Windows XP then you need to use the toolset with _xp suffix.
Related
Why does Microsoft visual studio has different configuration properties for settings 'Windows SDK' and 'platform toolset' in same project?
I have the understanding that every windows SDK provides new/different version of platform toolset.
So how does it make sense to specify platform toolset of say Windows 10 SDK and at the same time setting the SDK option to say Windows 8.1 SDK in the same project?
Very confusing.
Accoding to the Doc
For the Windows target platform, Windows SDK Version specifies the
version of the Windows SDK that your project requires.
Platform Toolsetallows the project to target a different version of
the Visual C++ libraries and compiler. Visual Studio C++ projects can
target either the default toolset installed by Visual Studio, or one
of the toolsets installed by several previous versions of Visual
Studio, including toolsets that create executables that can run on
Windows XP.
"I have the understanding that every windows SDK provides new/different version of platform toolset"
The platform toolset consists of the C++ compiler (cl.exe) and linker (link.exe), along with the C/C++ standard libraries. Platform Toolset is related to visual studio version. For example :
Visual Studio 2015: v140
Visual Studio 2017: v141
Visual Studio 2019: v142
Windows SDK is related to windows version. For example:
Windows SDK(10.0.18362.0):Windows 10, version 1903
Windows SDK(8.1): Windows 7 or Windows Vista
This question already has answers here:
MSVCP140.dll missing
(4 answers)
Closed 6 years ago.
I'm using Microsoft Visual Studio 2015 on Windows 8.1. I want to compile a program targeting Windows XP. I've looked it up on Google and other similar questions, but none helped. In the solution settings, target platform toolset is set to the Windows XP one, but there is no option for Windows XP in the target platform version.
I did read https://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.85).aspx (Using the Windows Headers) and added these lines to my program:
#define WINVER _WIN32_WINNT_WINXP
#define _WIN32_WINNT _WIN32_WINNT_WINXP
#define NTDDI_VERSION NTDDI_WINXP
But it still doesn't work. It says that it can't find "MSVCP140.dll". After I got this dll, it begins to complain about can't find "VC140.dll". After that is "ucrtbased.dll", and then finally "api-ms-win-core-string-11-1-0.dll", which I don't even have it in my Windows 8.1 computer. The program can run on Windows 8.1, but not Windows XP.
What can I do to make the program run on Windows XP?
In order to build a Windows XP compatible EXE with VS 2015 (or VS 2012 / VS 2013) you have to use the v140_xp Platform Toolset rather than the default v140 Platform Toolset.
UPDATE: Note that VS 2017 includes support for Windows XP via v141_xp. For VS 2019, this feature is no longer being updated but you can still install the v141_xp toolset to use with the VS 2019 IDE.
See your Project Properties, the General page:
This is because the default Platform Toolset uses the Windows 8.1 SDK (or you can opt into the Windows 10 SDK), and this only supports building applications for Windows Vista or later. When you select the v140_xp Platform Toolset, you are using a version of the Windows 7.1 SDK which was the last version to support targeting Windows XP or Windows Server 2003.
Note that Visual Studio can target Windows XP Service Pack 3 or Windows Server 2003 Service Pack 2. The C/C++ Runtime is not compatible with older versions of Windows.
If you are using DirectX in your app, this has some profound implications because a lot changed between the Windows 7.1 SDK and the Windows 8 SDK. See this post for details.
With VS 2015, you will also need to select the Windows XP support in the Custom Install options or via Programs & Features / Microsoft Visual Studio 2015 / Change... / Modify:
It sounds like the program runs fine on your development machine (Windows 8.1 + MSVS 2015), but doesn't run on an XP machine.
SOLUTION: you must include the MSVC runtime along with your .exe.
Look here: Deploying Native Desktop Applications (Visual C++)
and here: Visual C++ Redistributable for Visual Studio 2015.
Update from Chuck Walbourn -
Note that in the particular case of VS 2015 Update 3 and VS 2017, you
can use the VS 2017 or 2019 REDIST and it will work fine. See:
VC Runtime in MSVC 2017 is binary compatible with
2015
and
Microsoft Docs: C++ binary compatibility between Visual Studio
2015, 2017, and
2019.
And to repeat - your "setup" should include a compatible MSVC runtime (aka "VCRedist").
I have a project created on Visual Studio 2010. When I try to run the project on Visual Studio 2015 Community edition I get the error below,
Severity Code Description Project File Line
Error MSB8020 The build tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, please install Visual Studio 2010 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". graphics C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.targets 55
And when I tried to build it with Visual Studio 2015 Build Tools I encountered about 1500+ errors.
Is there any way to make the project work?
If you can't install VS2010, Windows SDK for Windows 7 contains needed compiler tools (v100), you may actually skip installing the SDK itself and install only the compiler tools, headers and libs. Please note, that the compiler included in Windows SDK is the same that VS2010 has, but VS2010 SP1 has a bit newer compiler. If you need that, you'll also need to install Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1. But be aware, that if you install these, you may have issues later if you decide to install VS2010, there are bugs in installer that requires you to install components in strict order. Also, if your code uses MFC or ATL you must install VS2010, installing Windows SDK will not be enough.
You either install VS 2010 and build your project, or better yet you upgrade your projects. The VS 2015 custom install options will let you install the v120 Platform Toolset, but not the v110 or v100 Platform Toolsets.
One major change in VS 2015 is that the C++ tools (i.e. v140) are not installed by the Typical installation option. See the Visual C++ Team Blog.
Keep in mind that Visual C++ 2010 used the C++0x Draft Standard, and Visual C++ 2015 meets the C++11 Standard with the exception of Expression SFINAE (which is partly there in Update 1), so quite a bit has changed in the intervening years including some breaking changes. Since you are jumping three major releases at once--and about 10 minor updates--, it can be a bit overwhelming especially working through all the new warnings.
Another thing to keep in mind is that Visual C++ 2010 used the Windows 7.1 SDK, while Visual C++ 2012 or later use the Windows 8.x SDK. There's been a lot of change there too particularly for DirectX development. It's particularly important for Windows desktop apps that you set the _WIN32_WINNT preprocessor define for your target platform as the Windows 8.x SDK does not default to the 'oldest supported platform' like earlier Windows SDKs did. See Using the Windows Headers
VS 2010 and the v100 toolset supports targeting Windows XP and Windows Server 2003. The v140 toolset does not support targeting Windows XP / Server 2003. You have to use v140_xp Platform Toolset instead. See this post for some notes as this means you are again using the Windows 7.1 SDK rather than the Windows 8.x SDK with the _xp toolsets.
See Breaking Changes in Visual C++ 2012, Breaking Changes in Visual C++ 2013, and Breaking Changes in Visual C++ 2015.
See also Support For C++11/14/17 Features (Modern C++), and Where is the DirectX SDK?.
If you need to build the code both with VS 2010 and with VS 2015, then you should create two projects/solution files, one for each. You may also want to read this article for some notes on writing code that can build with multiple Visual C++ toolsets, which again is particularly challenging due to the Windows SDK changes.
VS 2015 supports targeting Windows Vista SP2, Windows 7 SP1, Windows 8.0, Windows 8.1, Windows 10, and optionally Windows XP SP3. It does not support targeting Windows Vista RTM, Windows Vista SP1, or Windows 7 RTM.
How can I change the target platform to Windows 7? All I can chose is Windows 8.1 and therefore my project does not run on Windows 7. The same project I used to compile on my old Windows 7 PC with Visual Studio 2013. And of course it worked there.
I already tried to install Windows 7 SDK but sadly this does not work since it requites Net Framework 4.0 which I can not install anymore. (Windows 10 includes 4.6?) - https://msdn.microsoft.com/en-us/en-en/library/ff770576.aspx
Thanks.
From MSDN:
Target Platform Version
[...]
To target Windows 7 or Windows Vista, use the value 8.1, since Windows SDK 8.1 is backward compatible to those platforms. In addition, you should define the appropriate value for _WIN32_WINNT in targetver.h. For Windows 7, that's 0x0601. See Modifying WINVER and _WIN32_WINNT.
To get additional target platforms (i.e. older Visual C compilers), install the respective older Visual Studio version(s) in parallel.
For instance, if you want to use Visual Studio 2017 in the GUI and want to build against VC2008 (msvc90), install Visual Studio 2008 in parallel to Visual Studio 2017. In VS2017, in the build settings, you can then select the "VC 2008" build target.
Also see:
https://poweruser.blog/visual-studio-2017-compile-against-older-visual-c-c-runtimes-372519fe1400
I need to build application that could run on Windows XP. For this reason I found option Platform Toolset that might be set to Visual Studio 2012 - Windows XP (v110_xp) and definition #define _WIN_VER 0x0501. What does Platform Toolset does and maybe I don't need it if I define _WIN_VER 0x0501?
When you build with VS 2012 using the "v110" Platform Toolset, you are using the VS 2012 compiler and C Runtime building with the Windows 8.0 SDK. This must target Windows Vista or later because the Windows 8.0 SDK does not support building applications for Windows XP or Windows Server 2003. By default it targets Windows 8 or later, but you can set the preprocessor symbol _WIN32_WINNT to 0x0600 for Windows Vista or later, or 0x0601 for Windows 7 or later.
When you build with VS 2012 using the "v110_xp" Platform Toolset, you are using the VS 2012 compiler and C Runtime building with the Windows 7.1A SDK--the last version of the Windows SDK to support targeting Windows XP SP3 / Windows Server 2003 SP2.
Be sure to read this Visual C++ blog post and this DirectX SDK blog post for important information about using the Windows XP Platform Toolsets.
Note: With VS 20123, the "v120" Platform Toolset builds with the VS 2013 compiler, C Runtime, and Windows 8.1 SDK. It defaults to targeting Windows 8.1, but you can set the preprocessor symbol _WIN32_WINNT to 0x0600 for Windows Vista or later, 0x0601 for Windows 7 or later, or 0x0602 for Windows 8 or later. The "v120_xp" Platform Toolset builds with the VS 2013 compiler, C Runtime, and Windows 7.1A SDK.
It's just toolset. Maybe you installed only visual studio 2012, and if so you could see Visual Studio 2012 (v110) and Visual Studio 2012 - Windows XP (v110_xp).
In my case, I use several version of visual studio, so I can see Visual Studio 2008 (v90), Visual Studio 2010 (v100), etc. If I select Visual Studio 2008 (v90), the program is compiled with vs2008, even if I'm working on vs2012.
At first, VS2012 doesn't support windows xp, so its toolset also doesn't support windows xp. But after many developers ask MS to support winxp, MS adds a toolset for winxp, v110_xp. So you should use v110_xp toolset if you want to build application for windows xp.
Maybe you don't need set _WIN_VER, because vs2012 already defined it over Windows Vista at least.