在VS中编译C ++,而不需要在运行时MSVCP120D.dll [英] Compile C++ in VS without requiring MSVCP120D.dll at runtime
问题描述
正如您可以在这里看到的,MSVCP DLL是平台的C ++标准库的实现。总之,这意味着你不能分发你的应用程序,而不需要这些库提供的东西。所有编译器不管平台如何,都需要某种标准库的实现。通常,这是以库的形式分发的。
但是,您可以分发您的应用程序,以便stuff直接内置到您的程序,一个单独的DLL。为此,您必须将应用程序静态链接到标准库。
有几种方法可以实现此目的。一种方法是在项目设置。在配置属性>C / C ++代码生成>运行时库中,选择多线程(/ MT),而不是Mutithreaded(Static)。
< hr>
顺便说一下,上面提到的MSVCP120D.dll中的D表示调试。这意味着您正在尝试分发您的程序的 debug 构建。你应该(几乎)永远不要这样做。分发发布版本。
I'm trying to make a binary that can be run on any windows machine without the visual c++ stuff installed (I'm assuming that's what MSVCP120D.dll is however my searching was not very fruitful as to what this actually is). I made a game for an assignment and wanted to have other people (non-devs without VS stuff installed), help me test it but they kept getting errors saying that the above dll is missing. I'm not using any Visual C++ stuff and have the /Za flag set to ensure that it's just ANSI C++. Does Visual Studio support compiling ANSI C++ and if so how do I go about making it not use Visual C++ stuff, if it doesn't support this what compiler should I use?
As you can see here, the MSVCP DLL is the platform's implementation of the C++ Standard Library. In short what that means is you cannot distribute your application without needing the "stuff" that these libraries provide. All compilers regardless of platform would need some kind of implementation of the Standard Library. Typically this is distributed in the form of libraries.
However you can distribute your application so that the "stuff" is built in to your program directly, rather than being shipped in a separate DLL. In order to do this, you must statically link your application to the Standard Library.
There are a few ways to accomplish this. One way is in Project Settings. In "Configuration Properties" > "C/C++ Code Generation" > "Runtime Library", choose "Multithreaded (/MT)" as opposed to "Mutithreaded (Static)".
By the way, the "D" in "MSVCP120D.dll" you mentioned above means "Debug." This means that you are trying to distribute a debug build of your program. You should (almost) never do this. Distribute release builds instead.
这篇关于在VS中编译C ++,而不需要在运行时MSVCP120D.dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!