本文介绍了在C / C ++ for Windows中开发时,忽略msvcr100.dll?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Windows的C / C ++中开发,而不是链接到msvcr100.dll?

Is it possible to develop in C/C++ for windows and not to link against the msvcr100.dll?

我知道这是Windows的标准c库,但我想知道如果我没有安装Visual Studio或Redistributable包,我的计算机上的所有程序如何运行。

I understand that this is the standard c library for windows, but I was wondering how all the programs on my computer could run if I hadn't Visual Studio or the Redistributable package installed?

推荐答案

p>在解决方案资源管理器窗口中,右键单击您的项目,属性,C / C ++,代码生成,运行时库设置。将其更改为/ MTd。重复上面的配置,选择/ MT

Right-click your project in the Solution Explorer window, Properties, C/C++, Code Generation, Runtime Library setting. Change it to /MTd. Repeat for the Release configuration, pick /MT

现在你将链接静态版本的CRT,你使用的任何函数直接链接到你的EXE, msvcr100.dll在运行时。因此,您不再需要随程序部署DLL。

You will now link the static version of the CRT, any functions you use get directly linked into your EXE instead of getting them from msvcr100.dll at runtime. So you no longer have the requirement to deploy the DLL along with your program.

如果您创建自己的DLL,请避免使用此选项。然后变得重要的是那些DLL和EXE使用完全相同的CRT,因此他们将共享相同的CRT状态和相同的堆。因为如果他们不然,那么你会有令人讨厌的问题,传递C ++对象或指针,需要从一个代码块释放到另一个。 AccessViolation如果你幸运,如果你不是内存泄漏。

Avoid using this option if you create your own DLLs. It then gets to be important that those DLLs and the EXE use the exact same CRT so they'll all share the same CRT state and the same heap. Because if they don't then you'll have nasty problems with passing C++ objects or pointers that need to be released from one chunk of code to another. An AccessViolation if you are lucky, a memory leak if you are not.

这篇关于在C / C ++ for Windows中开发时,忽略msvcr100.dll?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 15:21