프로그램을 설치하거나 실행 하다보면 dll들이 없다면서 에러가 나는 경우가 있는데, 만약 제목에 나와있는 dll들이라면,
Microsoft Visual C++ 2010 재배포 가능 패키지를 설치하면 해결된다.
원인은.. 설치프로그램이 필요한 dll들을 포함하지 않고 만들어졌기 때문에 발생하는 문제일 것이다.
Microsoft Visual C++ 2010 재배포 가능 패키지 32bit link:
http://www.microsoft.com/ko-kr/download/details.aspx?id=5555
Microsoft Visual C++ 2010 재배포 가능 패키지는 32bit/64bit가 각각 다르지만, 둘 다 설치 가능하다.
만약 OS가 64bit라면 둘다 설치해 놓면 좋다. 왜냐면, Microsoft Visual C++ 2010 재배포 가능 패키지는 os의 32/64bit가 아니라,
설치하려는 프로그램이 32bit S/W인가 64bit S/W인가에 의해 필요한 dll을 Microsoft Visual C++ 2010 재배포 가능 패키지에서 참조하기 때문이다.
dll에 대한 내용은 아래 참조.
출처 : http://www.rhyous.com/2010/09/16/avoiding-the-msvcr100-dll-or-msvcr100d-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.
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:
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.
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:
- Statically link to the dll files so they are compiled into my executable instead of referenced as separate dll files.
- Included the dll in the same directory as the exe (I actually didn’t try this but I assume it would work).
- 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
- In Visual Studio, I went to the project Properties.
- I changed my Configuration to Release.
- I went under Configuration Properties | C/C++ | Code Generation
- Look at the Runtime Library setting. It is set to this: Multi-threaded DLL (/MD)
Change it to this: Multi-threaded (/MT)
- Rebuild.
Debug
Almost exactly the same as release.
- In Visual Studio, I went to the project Properties.
- I changed my Configuration to Debug.
- I went under Configuration Properties | C/C++ | Code Generation
- Look at the Runtime Library setting. It is set to this: Multi-threaded Debug DLL (/MDd)
Change it to this: Multi-threaded Debug (/MTd)
- 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.
http://www.microsoft.com/ko-kr/download/details.aspx?id=5555