在C / C ++为Windows开发时省略了msvcr100.dll? [英] Omit the msvcr100.dll when developing in C/C++ for windows?

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

问题描述

是否有可能在C开发/ C ++的Windows,而不是针对msvcr100.dll链接?

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

我明白,这是Windows的标准C库,但我想知道如何在我的电脑上的所有程序可以运行如果不是我的Visual Studio或再发行组件包安装?

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?

推荐答案

右键单击您的项目将在解决方案资源管理器窗口,属性,C / C ++,code生成,运行时库设置。将其更改为/ 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 ++对象,或者需要从code的一个块释放到另一个指针讨厌的问题。一个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 ++为Windows开发时省略了msvcr100.dll?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆