问题
I made a program in Visual Studio 2010 on Windows 7 64-bit. When I try to run it on Windows XP 32-bit I got message that msvcr100.dll is missing. When I try to copy that file from Win7 to WInXP I got message that msvcr100.dll is wrong. How to set building in VS so msvcr100.dll would not be necessary?
回答1:
First you need to make sure you're building a 32 bit executable - 64 bit ones won't run on 32 bit Windows.
Then you can either...
- Ship the 32 bit redistributables with your application.
- Remove the runtime dependency altogether and link statically to the C++ runtimes. To do this, set
Project -> Properties -> Configuration Properties -> C/C++ -> Code Generation -> Runtime Library
toMulti-threaded (/MT)
.
回答2:
Linking the runtime libraries statically should help. Go to Project Options -> C/C++ -> Code Generation -> Runtime Library and change the value to Multithreaded or Multithreaded Debug and recompile. This way your application shouldn't depend on the runtime DLLs.
Also don't forget to build a 32bit executable.
回答3:
The answers above helped me along, but I was still getting the error:
fatal error C1189: #error : Please use the /MD switch for _AFXDLL builds
So to help other who may have, like me, spent way too much time stumbling around in search of a clear solution, I'd like to add the bit of information that solved this issue for me. As it turns out, my project had the wrong "Use of MFC" setting to make use of the answer above.
To put it in clear terms:
Open up the project properties (alt-F7 or Project-menu -> [My Project] Properties) and go to Project -> Properties -> Configuration Properties
If General -> Use of MFC
is set to Use MFC in a Static Library
you must set
C/C++ -> Code Generation -> Runtime Library
to either Multi-threaded Debug (/MTd)
or Multi-threaded (/MT)
and if
General -> Use of MFC
is set to Use MFC in a Shared DLL
you must set
C/C++ -> Code Generation -> Runtime Library
to either Multi-threaded DLL (/MD)
or Multi-threaded Debug DLL
I got this answer from the Microsoft community answers website and all credit should go to David Wilkinson.
回答4:
enter image description here
Step 1.: Go to this website dll-files.com. enter image description here
dll-files.com is a great repository of Windows DLL files and has almost all the DLL files that are existent on Windows.
Step 2. Now type there your DLL error in the search window of the website.
Step 3. DLL-Files.com will immediately list out the zip file containing that particular DLL file. Download this zip file to your computer and extract it. The extracted folder will contain the DLL error file.
enter image description here
Step 4. Copy the download DLL file (Only that file) and paste this file in your default system folder based on your operating systems below. C:WindowsSystem (Windows 95/98/Me) C:WINNT\System32 (Windows NT/2000) C:\Windows\System32 (Windows XP, Vista, Windows 7/Windows 8.1/Windows 10)
Windows will ask you whether you want to replace the existing DLL file with the new one. Say yes and let Windows copy the file. Restart your computer and voila, you can now run the game/app that was not opening and giving the DLL error, easily.
There are many other websites which will give you DLL files that you want
来源:https://stackoverflow.com/questions/3768522/missing-msvcr100-dll