C++ executable - MSVCR100.dll not found error

百般思念 提交于 2019-12-09 13:07:23

问题


I've downloaded and compiled an open-source C++ application, Frhed.

When I run the version I've compiled, it demands MSVCR100 and few other dll files (part of Visual C++ redistributable). However, when I run the original precompiled Frhed executable, it runs without any C++ redistributable package installed.

Do I have to modify any compilation options in order to unlink the program from the C++ redistributable libraries?


回答1:


The original program is probably statically linked, whereas you are trying to dynamically link your executable, which results in a smaller file, but a dependency on functions inside MSVCR100.dll (v10 of the Microsoft C Runtime Library), which would have been included inside the executable if you were statically linking.

To statically link DLLs, go into your project properties and change the build mode from MD to MT. In Visual Studio 2010/2012, that project property is C/C++ -> Code Generation -> Runtime Library.




回答2:


The short answer is yes, the longer answer is, well, longer.

The library msvcr100.dll is the 10.0 version (i.e., Visual Studio 2010 version) of the DLL implementation of the C run-time which you probably requested by using the /MD compile option. To avoid using the dynamically linked version of the run-time you can use the /MT option instead and statically link the run-time.

Alternatively, you can redistribute msvcr100.dll (and other files) along with your program.



来源:https://stackoverflow.com/questions/6976940/c-executable-msvcr100-dll-not-found-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!