Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Visual Studio 2012 and compile with older platform toolset?

The problem

I'm using Visual Studio 2012 to develop C++ DLLs. On some machines these DLLs can not be loaded, because the platform toolset, which is set to "v110" is missing.

I have tried to install older c++ runtimes. They didn't install because "a newer version is already installed". I also installed the current Windows SDK, but there are still no other items to choose from than v110.

Question

How can I compile my C++ DLL with an older version of the C++ runtime so it will run on non-developer machines?

Platform toolset is v110

like image 518
bytecode77 Avatar asked Mar 16 '13 19:03

bytecode77


People also ask

How do I change the platform toolset in Visual Studio?

To change the platform toolsetIn the properties page, select Platform Toolset and then select the toolset you want from the drop-down list. For example, if you've installed the Visual Studio 2010 toolset, select Visual Studio 2010 (v100) to use it for your project. Choose the OK button to save your changes.

Can I install Msvc without Visual Studio?

TL;DR: Yes, you can build from the command line without using or even installing the IDE.

How do I install Microsoft Visual C++ MSVC compiler toolset?

Download and install the tools When you run the downloaded executable, it updates and runs the Visual Studio Installer. To install only the tools you need for C++ development, select the Desktop development with C++ workload. You can select optional libraries and toolsets to include under Installation details.

Where is MSVC compiler installed?

More precisely, the default path where you'll find the compiler is C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin .


2 Answers

According to this page on MSDN, you need to have the corresponding version of Visual Studio (2008 or 2010), or the relevant Windows SDK for the "Platform Toolset" drop down to list those versions:

To change the target platform toolset, you must have the associated version of Visual Studio or the Windows Platform SDK installed.

You also seem to be a little bit confused between "Platform Toolset", which controls which compiler/linker/etc. is used to build your application, and "Visual C++ Redistributable", which is needed to run your application. You can't install a "Platform Toolset" on a user's PC, and nor will you make one available by installing a particular "Visual C++ Redistributable" on your development PC.

Also, as far as I know, the Visual C++ Redistributable doesn't include the MFC runtimes. They're available as a separate MSI merge module (MSM).

like image 119
Roger Lipscombe Avatar answered Sep 25 '22 14:09

Roger Lipscombe


I'd like to share some information, which I came across and figured out how to use them for my purpose.

Apparently it is a good option to use static linking. It didn't always work for me, but for a smaller project of mine, it works quite good. And the result is a DLL with no dependencies other than kernel32.dll and the like.

Simply use /MT for release configuration and /MTd for debug and you'll be fine.

The problem here is that a developer like me gets the current Visual Studio version, shortly after its release, but you can't really expect common users to have runtimes installed which are only a few weeks old. And installing different versions of Visual Studio just to use the old runtime is definitely not what you want.

Static linking in Visual Studio 2013

like image 39
bytecode77 Avatar answered Sep 22 '22 14:09

bytecode77