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

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).

Related

How add to Visual Studio 2017 or 2019 old C++ (v110) compiler?

I need compile my C++ project with old compiler verison. I saw, that is possibly to add to new visual studio old compiler. I try to download and install some build kit and remote utility for VS 2020 (ver v110), but nothing changed. I expect in properties - platform toolset - new line - v110, but nothing happen.
What I shloud to download and install and what to do?
You could install VS2012 platform toolset. In fact, you don't need to uninstall the redistributables. It's just that there may be installation errors.Also, if you unstall them, you could re-install them in Microsoft Downloads.
Then, you could change v110 in properties -> platform toolset.
For the previous version of VS2012, you can go to download it on daffodil website.
You need to install the old Visual Studio 2012 to use the compiler in a newer Visual Studio (e.g. 2017). Therefore uninstall the redistributables ("Microsoft Visual C++ 2012 Redistributable") to avoid errors.
Then you have to install the old Visual Studio 2012 and it's updates if required.
Afterward you will probably have to "repair" the newer Visual Studio Installations.

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

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.

Visual studio platform toolset vs Windows SDK

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

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 correctly install platform toolsets

I know there are tons of other threads about it, but I couldn't find any which could help me.
So I've got VS2013 Ultimate installed. I've got an old project which works with only VS2008SP1. On other compilers it has compatibility issues which I don't want to bother with. So I would like to try to compile it from 2013 with 2008 tools, so I hope I can compile it without uninstalling my current VS2013.
So, if I install VS2008, will this overwrite my current 2013 or just getting added as a toolset?
If I use 2008 toolset, will this work the same way as I had a VS2008?
Do I have to do something else to make it work?
And just a secondary question which is not related to may current question at all:
If I compile a lib with VS2013, can I use this lib in my VS2008 Project, or do I have to compile the lib with VS2008 too?
Thank you for your answers!
Microsoft doesn't recommend installing VS 2008 if you already have VS 2013 installed. In general they say:
We recommend that you install Visual Studio versions in the order in
which they were released. For example, install Visual Studio 2012
before you install Visual Studio 2013.
http://msdn.microsoft.com/en-us/library/ms246609.aspx
So, to answer your question: you probably should uninstall VS 2013, but you can install it again after installing VS 2008. Before doing that though it might be a good idea to clean the register as well as file leftovers from VS 2013 to avoid compatibility problems.
And yes, you can use 2008 compiler in 2013 version. There are a plenty of SO thread about it, e.g. :
Use Visual Studio 2012 and compile with older platform toolset?
How can I use Visual Studio 2010 with the Visual C++ 2008 compiler?
If I compile a lib with VS2013, can I use this lib in my VS2008
Project, or do I have to compile the lib with VS2008 too?
You have to compile this lib in VS 2008, if you want to use it with VS 2008.