【转载】MSVCR100.dll和MSVCP100.dll的区别

本文涉及的产品
云数据库 Tair(兼容Redis),内存型 2GB
Redis 开源版,标准版 2GB
推荐场景:
搭建游戏排行榜
简介:


MSVCR100.dll

This msvcr100.dll is the Microsoft Visual C++ Redistributable dll that is needed for projects built with Visual Studio 2010. The dll letters spell this out.

MS = Microsoft
V = Visual
C = C program language
R = Run-time
100 = Version

If you create a C++ project in Visual Studio 2010, this file is probably needed.

MSVCP100.dll

This msvcp100.dll is the Microsoft Visual C++ Redistributable dll that is needed for projects built with Visual Studio 2010. The dll letters spell this out.

MS = Microsoft
V = Visual
CP = C++
100 = version

If you create a C++ project in Visual Studio 2010, this file is probably needed.

MSVCR100D.dll

The MSVCR100D.dll is almost the exact same file only the D at the end stands for Debug. This file has debugging enabled and is not considered redistributable.

Why the error?

Ok, so recently I switched to Visual Studio 2010.  I had a C++ application that worked perfectly in Visual Studio 2008.  Once I compiled it with Visual Studio 2010 and ran it on a clean 2008 server (fully patched but otherwise clean), it failed to run with the following error.

TestWin32.exe – System Error

The program can’t start because MSVCR100.dll is missing from your computer. Try reinstalling the program to fix this problem.

Here is the screen shot:

msvcr100.dll

The same things happens with the debug version of the file, only it is a the debug version of the same DLL as noted by the fact that the DLL name ends with D.

Autorun – System Error

The program can’t start because MSVCR100.dll is missing from your computer. Try reinstalling the program to fix this problem.

The screen shot is identical except for the D in the dll name.

msvcr100d.dll

I create a new project in Visual Studio 2010 using the project type of C++ Win32 Project and without making a single change to the default project, I built the file and tested it on my clean machine and the same issue occurred.

So obviously that is not acceptable.  It seems like this should just not happen by default, but unfortunately it does.

Solution

It was actually really easy to resolve for my one project.

Here is what I did.

You can solve this any of the following ways:

  1. Statically link to the dll files so they are compiled into my executable instead of referenced as separate dll files.
  2. Included the dll in the same directory as the exe (I actually didn’t try this but I assume it would work).
  3. Forced everyone to install the VC++ Runtime Redistributable before running the app.

The first option seems the most stable and robust and easiest for a single executable. So that is the one I am going to use.

The second option doesn’t really make sense to me and I would probably never do it.  Maybe if I had dozens of executable files that all required the same DLL and I didn’t have an installer, and I wanted to conserve size, which probably wouldn’t happen for me since I am pretty good at creating a quick installer. Though you might be in this a situation.

The third option would make sense if I was planning on running my executable after an install.  During the install I could include the VC++ Runtime Redistributable and all would be fine.

Statically Linking the DLLs

Make sure you resolve it for both Release and Debug.  The steps are slightly different.

Release

  1. In Visual Studio, I went to the project Properties.
  2. I changed my Configuration to Release.
  3. I went under Configuration Properties | C/C++ | Code Generation
  4. Look at the Runtime Library setting.  It is set to this: Multi-threaded DLL (/MD)
    Change it to this: Multi-threaded (/MT)
  5. Rebuild.

Debug

Almost exactly the same as release.

  1. In Visual Studio, I went to the project Properties.
  2. I changed my Configuration to Debug.
  3. I went under Configuration Properties | C/C++ | Code Generation
  4. Look at the Runtime Library setting.  It is set to this: Multi-threaded Debug DLL (/MDd)
    Change it to this: Multi-threaded Debug (/MTd)
  5. Rebuild the debug

It might be a good idea for me to figure out how to change the project so when I create a new project of this type, those settings are the default.



相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore     ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库 ECS 实例和一台目标数据库 RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
目录
相关文章
|
2月前
|
Web App开发 安全 Shell
遭遇sqmapi32.dll,kvmxfma.dll,rarjdpi.dll,google.dll,a0b1.dll等
遭遇sqmapi32.dll,kvmxfma.dll,rarjdpi.dll,google.dll,a0b1.dll等
|
2月前
|
安全 Windows
遭遇scvhost.exe,qsetup.exe,dsound.dll,hnetcfg.dll,olepro32.dll等2
遭遇scvhost.exe,qsetup.exe,dsound.dll,hnetcfg.dll,olepro32.dll等2
|
2月前
|
安全 Windows
遭遇scvhost.exe,qsetup.exe,dsound.dll,hnetcfg.dll,olepro32.dll等1
遭遇scvhost.exe,qsetup.exe,dsound.dll,hnetcfg.dll,olepro32.dll等1
|
11月前
|
Windows
DLL介绍
DLL介绍
280 0
DLL介绍
|
开发框架 .NET C#
JsonRequestBehavior不存在问题,JsonRequestBehavior属于哪个dll
JsonRequestBehavior不存在问题,JsonRequestBehavior属于哪个dll
|
Web App开发 安全
|
C++
C++ DLL导出类 知识大全
在公司使用C++ 做开发,公司的大拿搭了一个C++的跨平台开发框架。在C++开发领域我还是个新手,有很多知识要学,比如Dll库的开发。    参考了很多这方面的资料,对DLL有一个基本全面的了解。有一个问题让我有点困惑,普通的导入导出C++类的方式都是使用_declspec(dllexport) /_declspec(dllimport)来导入导出类,但是在公司的开发中我们没有导入导出,而是定义了一些只有纯虚函数的抽象类,然后定义了一个工厂类,将这个工厂类注册到框架的服务中心中,使用时从服务中心拿到这个工厂类,就可以创建Dll中的其它类。
1753 0