So I compiled a C++ code which uses the Boost library (if that's significant) with Visual Studio 2012 and am currently testing the executable on different machines with Windows. On some it works fine while on the others it gives an error that it couldn't find MSVCP110D.dll and will therefore not run. Is there any other way to make it run that creating an installer which would include the DLL? Can I somehow compile the DLL into my executable so that it runs even on machines without the proper libraries?
5 回答
You're linking against the debug CRT. Change that to the release one, and you can then redistribute the required DLLs as part of your install (it is not legal to do so with the debug ones)
MSVCP110D.dll is a runtime library. You can link to the runtime libraries statically. Go to Project Properties
->Configuration Properties
->C/C++
->Code Generation
and set the Runtime Library
to /MT in Release mode and /MTd in debug mode. Alternatively, make sure that Visual Studio 2012 redistributable is included in your installer package.
You can statically link it. I am not sure about Microsoft Visual studio, but using GCC, you can use the -static
option.
Compile your DLL code to a static library (LIB file), and link your EXE with that.
I understand that you wish to avoid using an installer, but are you aware of this free, powerful and quite easy to use installer: NSIS (made by the same guys who wrote WinAmp)
Here are other choices. Perhaps you can find one that just makes it easy enough (at the right price) that you might change your mind on not wanting to use one.