views:

318

answers:

1

I created a simple C executable in Visual C++ 2010, but when others tried it they got a missing MSVCR100.dll error. Apparently, the user needs to install the Visual C++ Redistributable Package in order to run the exe. Is there any way I can instead include MSVCR100.dll inside the exe (so it's just one file, not sitting in the same folder) so people can just run the executable and have it work? Thanks for your help.

Edit: Or at least maybe a way to run the Visual C++ Redistributable Package installer from my exe if it needs to be run?

+2  A: 

The easiest way to do what you're looking for is to statically link the C run time - then there's no dependency on the DLL - it's baked into the .exe.

You want to go into the project property's "Configuration Properties/C-C++/Code Generation" tab and change the "Runtime Library" section to "Multi-threaded (/MT)"

Michael Burr
While compiling with this option got rid of the missing dll error, the program no longer works at all. Maybe some of the commands only work correctly with that library?
B_
@B_: What other libraries are you using/linking against? Does it work with "Multi-threaded debug (/MTd)"?
Michael Burr