简体   繁体   English

使用Visual Studio 2012并使用较旧的平台工具集进行编译?

[英]Use Visual Studio 2012 and compile with older platform toolset?

The problem 问题

I'm using Visual Studio 2012 to develop C++ DLLs. 我正在使用Visual Studio 2012来开发C ++ DLL。 On some machines these DLLs can not be loaded, because the platform toolset, which is set to "v110" is missing. 在某些机器上,无法加载这些DLL,因为缺少设置为“v110”的平台工具集。

I have tried to install older c++ runtimes. 我试图安装较旧的c ++运行时。 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. 我还安装了当前的Windows SDK,但仍然没有其他项目可供选择而不是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? 如何使用旧版本的C ++运行时编译我的C ++ DLL,以便它可以在非开发人员的机器上运行?

平台工具集是v110

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: 根据MSDN上的此页面 ,您需要具有相应版本的Visual Studio(2008或2010),或者“Platform Toolset”的相关Windows SDK下拉列表以列出这些版本:

To change the target platform toolset, you must have the associated version of Visual Studio or the Windows Platform SDK installed. 要更改目标平台工具集,必须安装相关版本的Visual Studio或Windows Platform SDK。

You also seem to be a little bit confused between "Platform Toolset", which controls which compiler/linker/etc. 您还似乎在“Platform Toolset”之间有点混淆,它控制着哪个编译器/链接器/等。 is used to build your application, and "Visual C++ Redistributable", which is needed to run your application. 用于构建应用程序,以及运行应用程序所需的“Visual C ++ Redistributable”。 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. 您不能在用户的PC上安装“Platform Toolset”,也不能通过在开发PC上安装特定的“Visual C ++ Redistributable”来使用它。

Also, as far as I know, the Visual C++ Redistributable doesn't include the MFC runtimes. 另外,据我所知,Visual C ++ Redistributable不包含MFC运行时。 They're available as a separate MSI merge module (MSM). 它们可作为单独的MSI合并模块(MSM)使用。

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. 结果是除了kernel32.dll之外没有依赖关系的DLL。

Simply use /MT for release configuration and /MTd for debug and you'll be fine. 只需使用/MT进行发布配置和/MTd进行调试,你就可以了。

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. 这里的问题是像我这样的开发人员在发布后不久就获得了当前的Visual Studio版本,但是你真的不能指望普通用户安装只有几周的运行时版本。 And installing different versions of Visual Studio just to use the old runtime is definitely not what you want. 并且安装不同版本的Visual Studio只是为了使用旧的运行时绝对不是你想要的。

Visual Studio 2013中的静态链接

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. 要在较新的Visual Studio(I testet 2013和2015)中使用v90平台工具集(= Visual Studio 2008) ,您需要安装Visual Studio 2008和Visual Studio 2010,因为MS Build程序文件夹中的vs90平台工具集定义是部分von Visual Studio 2010。

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

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

for V110 V120 and V140 适用于V110 V120和V140

representing Visual Studio Versions: v90=2008, v100=2010, V110=2012, V120=2013, V140=2015. 表示Visual Studio版本: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. 在安装vob VS2010之后,较新的Visual Studio 2013和2015版本可以使用vs90和vs100平台工具集。 (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. (这不会在没有Visual Studio 2013/2015的新安装的情况下实现。)我想Visual Studio 2012的运行方式与VS2013和VS2015相同。

well it depends what you are trying to build. 这取决于你想要建立什么。 Some things are maybe supported via installing Windows SDK 7.1. 通过安装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. 看到这篇文章,同样的问题 ,但如果你的项目依赖于MFC,那么不幸的是它看起来根本不可能,主要是因为VS2010正在部署MFC库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio:如何使用平台工具集作为预处理器指令? - Visual Studio: How to use platform toolset as preprocessor directive? Visual Studio cmake 目标平台和平台工具集 - Visual Studio cmake target platform and platform toolset 使用平台工具集v100的Visual Studio 2012。 无法打开源文件“ atlbase.h” - Visual Studio 2012 using platform toolset v100. Cannot open source file “atlbase.h” 使用v110_xp平台工具集在Visual Studio 2012下构建增强功能 - Building boost under Visual Studio 2012 with v110_xp platform toolset Visual Studio 希望使用错误的平台工具集进行构建 - Visual Studio wants to build with wrong platform toolset Visual Studio 平台工具集与 Windows SDK - Visual studio platform toolset vs Windows SDK Visual Studio Platform工具集和运行时库 - Visual Studio Platform toolset and Runtime Library 什么是 Visual Studio 项目中的“平台工具集”设置 - What is "Platform Toolset" setting in visual studio project 我需要安装什么来使用Visual Studio 2013编译Platform Toolset v100? - What I need to install to compile for Platform Toolset v100 using Visual Studio 2013? 使用vc100平台工具集而不安装Visual Studio 2010? - Use vc100 platform toolset without installing Visual Studio 2010?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM