How to not link against msvcr100.dll?

爱⌒轻易说出口 提交于 2019-12-12 09:04:21

问题


I am compiling project in Visual Studio 10, compiled executable runs fine on win 7 but it doesnt works on win xp because of missing msvcrt100.dll. I tried to use "/NOTDEFAULTLIB" but it also removes some other external libs that i use. Is there way to not link against latest Microsoft runtime library ?

Thanks in advance.


回答1:


To not link against the DLL you must link against the runtime statically.

To do this, go to C/C++ Properties -> Code Generation and under Runtime Library select Multi-threaded (/MT) or Multi-threaded Debug (/MTd) from the drop-down. Note, once you're using a static runtime library all of your other library code you link against must also be built with the same setting. And you will also likely have to add additional libraries to the Linker -> Input under Additional Dependencies.




回答2:


It only works on Windows 7 machine by accident, somebody installed that DLL earlier.

Short from creating an installer (easy to do with a Setup project), a simple fix is copying msvcr100.dll along with your own binaries. If you only have an EXE then the simple solution is to link the static version of the CRT. Switch to the Release build, right-click the project, Properties, C/C++, Code Generation, Runtime Library setting. Change it to /MT from the default /MD.



来源:https://stackoverflow.com/questions/11618650/how-to-not-link-against-msvcr100-dll

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