32

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

bytecode77
  • 14,163
  • 30
  • 110
  • 141
  • Have you tried installing the [Visual C++ Redistributable for VS 2012](http://www.microsoft.com/en-us/download/details.aspx?id=30679) on those non-developer machines and see if it works? – In silico Mar 16 '13 at 19:26
  • 11
    Yes, this works. But instead of forcing users into installing runtimes, I would prefer using older versions of these runtimes so my application will work on the target machine. How can I select an older version of the "Platform Toolset" in the properties window? – bytecode77 Mar 16 '13 at 19:36
  • 1
    you need to install the older visual studio – Radu Chivu Mar 16 '13 at 20:11

4 Answers4

24

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

Roger Lipscombe
  • 89,048
  • 55
  • 235
  • 380
7

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

bytecode77
  • 14,163
  • 30
  • 110
  • 141
  • 3
    Unfortunately, this is not an option if you use managed code (/clr flag). Compiling produces this message: `Command line error D8016: '/clr' and '/MT' command-line options are incompatible`. Here's a discussion on why: http://www.windows-tech.info/17/5f0fd2024b850de5.php – Rast Feb 16 '15 at 11:55
2

A hint for the internet archive. (I cannot comment the statements above, I don't know why)

To use the v90 platform toolset (=Visual Studio 2008) in a newer Visual Studio (I testet 2013 and 2015) you need to install Visual Studio 2008 and additionally Visual Studio 2010, because the vs90 platform toolset definitions in the MS Build programs folder are part von Visual Studio 2010.

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\PlatformToolsets for v90 and v100

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0

for V110 V120 and V140

representing Visual Studio Versions: v90=2008, v100=2010, V110=2012, V120=2013, V140=2015.

After the Installation vob VS2010 the newer Visual Studio 2013 and 2015 Versions could use the vs90 and vs100 platform toolsets. (This works immidiadtly without a new installation of Visual Studio 2013/2015.) I guess Visual Studio 2012 is doing it the same way like VS2013 and VS2015.

Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701
bernie3280109
  • 81
  • 1
  • 3
1

well it depends what you are trying to build. Some things are maybe supported via installing Windows SDK 7.1. see this post, same question, but if your project is dependent upon MFC then unfortunately it looks like it's not possible at all, mainly because nothing but VS2010 is deploying the MFC libraries.

Community
  • 1
  • 1
4pie0
  • 29,204
  • 9
  • 82
  • 118
  • As I stated, I did try to install Windows SDK, but I still couldn't choose older runtime versions. Also, I'm not using MFC. This DLL only contains one function and uses a couple of standard include files. – bytecode77 Mar 16 '13 at 20:06
  • please read this topic, they were able to use SDK7.1 toolset in VS2012 but get errors while compiling code – 4pie0 Mar 16 '13 at 20:08