Is it safe to link against more than one Platform Toolset? - c++

I am programming in C++ on Windows using Visual Studio 2019 and Qt.
I am using a library created by another programmer that depends on a 3rd party .dll that in turn depends on msvcp140.dll and vcruntime140.dll.
I have installed Platform Toolset Visual Studio 2015 (v140).
However I do not wish to link with this since it seems to prevent me from using ISO C++17 Standard (when I select Platform Toolset="Visual Studio 2015 (v140)" the C++ Language Standard option is removed).
Is it safe to mix Platform Toolset: "Visual Studio 2015 (v140)" and "Visual Studio 2019 (v142)"?
The other programmer claims so. He has made sure that his API does not use any std class (e.g. string) as input or output.
Is this sufficient or is there something else I have to think of?

As Hans Passant says, you can continue to use V142 for your VS2015 library. Hope this document could help you:
The runtime libraries and apps compiled by any of these versions of the compiler are binary-compatible. It's reflected in the C++ toolset major number, which is 14 for all three versions. (The toolset version is v140 for Visual Studio 2015, v141 for 2017, and v142 for 2019). Say you have third-party libraries built by Visual Studio 2015. You can still use them in an application built by Visual Studio 2017 or 2019. There's no need to recompile with a matching toolset. The latest version of the Microsoft Visual C++ Redistributable package (the Redistributable) works for all of them.

Related

How to install Visual Studio Build Tools 2010 on Visual Studio 2015 Community?

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 to install one version of visual studio 2013 with c++ 2010, 2012 and 2013 toolsets

How can I install visual studio 2013 with c++ 2010, 2012 and 2013 toolsets without installing any other visual studio versions (express or any other versions).
I need this so that I can keep my pc light and clean. Are there any alternatives to installing multiple visual studio versions for c++ toolsets?
I am developing a plugin for a program that has multiple version each compiled in c++ 2010 and c++ 2012 so I need those version of c++ toolset. For daily use I need visual studio 2013.
In the end I installed the express editions that use around 800mb each and do not add so much clutter.
MSDN's website says that if you want the C++ 2010 and C++ 2012 toolsets with VS2013, you'll need to install those VS versions on that particular machine. Link here
I don't think there are other alternatives to that.

Use VS2008 (v90) C++ toolset in VS2013?

MS documentation explains how to use 2010 or 2012 toolsets in VS2013.
Does anyone know if there is also backwards support for the 2008 toolset? I am upgrading several projects from 2008 to 2013 but my team lead would like us to upgrade the project files initially but still target the same compiler/runtime as 2008.
Is this possible?
The VS2008 install on its own doesn't properly setup the toolset directory/registry. This prevents later version of VS from locating the v90 tools.
If you install the VS2010 C++ compiler toolset it will include the v90 toolset as well. After doing this I am able to build in VS2013 with the VS2008 toolset. This can be done by installing VS2010 itself or installing the Windows 7.1 SDK which includes the 2010 toolsets (v90 and v100).
Reference:
MSDN
I get the option to select VS 2008 (v90) as a Platform Toolset for my VC++ projects in VS 2013. I did nothing special (other than VS 2008 was installed when I installed VS2013).

Can I use build against the 2008 VS Runtime with VS 2010 and no copy of VS 2008?

It looks like using Visual Studio 2010 it is possible to build against the 2008 runtime, if you have both editions installed: Can I use Visual Studio 2010's C++ compiler with Visual Studio 2008's C++ Runtime Library?
Is it possible to do this using just the free Windows Platform SDKs and VS 2010? Just to stress - installing Visual Studio 2008 is not an option.
Background: I'd like to build a Python module for Python 2.7. I have a copy of Visual Studio 2010, but Python 2.7 (specifically the Python(x,y) distribution) is built using 2008. Rebuilding Python, or rebuilding Python(x,y) is not something I want to get into (there are various other modules I want to use as well). My module needs to link against vendor-supplied libraries built using VS 2008/2010 (I've been given both sets of libraries). I don't own a copy of Visual Studio 2008, and I really don't want to have to buy one.
This MSDN article says that although you can change the platform toolset in the IDE you still need to have the VS2008 binaries installed.
I know you said installing 2008 was not an option but perhaps you can still find the free versions in an old SDK or even the Express version on the Microsoft website.

Visual C++ 2010 Express: extension SDK available?

Allegedly, Visual C++ 2010 Express, unlike previous versions, supports third party extensions. I just downloaded the release candidate SDK for Visual Studio 2010, but the installer fails saying that I don't have Visual Studio installed (which is true since i use Visual C++ 2010 Express). Have I missed something? Is there a version of the extension SDK that works with Express?
Visual C++ 2010 Express (or any of the Express versions for that matter) are NOT extensible.
The Visual Studio 2010 SDK can only be used with Professional or higher (as stated in the requirements on the download page).
You haven't missed anything, but your source of information was incorrect.