My application when opened in others computer will give an error missing msvcr\"something\".dll, I found out that to fix this they need to install the following: http://www.micr
Which is Visual C++ Redistributable Packages for Visual Studio 2013.
For Visual Studio 2013, you need:
If you were building with Visual Studio 2012, then you would need:
If you were building with Visual Studio 2012, then you would need:
The point is, you are probably going to need a runtime if you are writing portable C/C++ code by using functions like new
, malloc
, delete
, free
, etc.
You might be able to avoid the code if you use the Win32 API. For example, HeapAlloc
and HeapFree
, etc. Installers often use the Win32 API, and that's one of the reasons they usually don't need a runtime installed prior to running them.
I would like to compile the program with the DLLs in the executable already, is such thing possible?
Yes, its possible. Its called Static Linking (as opposed to Dynamic Linking).
But you will probably still need a runtime.
If not possible, where can I get all the DLLs to put in the compiled project folder?
Retired Ninja gave you this answer: Microsoft Visual Studio ~ C/C++ Runtime Library ~ Static/dynamic linking.
My application when opened in others computer will give an error missing msvcr "something".dll" ...
Another possible solution is to build your project with Visual Studio 2005 or Visual Studio 2008. The runtime used by VS2005 and VS2005 are usually available on Windows Vista, Windows 7, and Windows 8. So the computer may already have them.
But usually you just build your installer to carry around what you need. I use Inno Setup because it allows you to include both x86 and x64 components side-by-side. At install time, you just install the right components based on architecture (x86 vs x64), including the correct runtime. (At the time I choose Inno, Wix did not allow mixing architectures and I wanted a unified installer).
Because a lot of Programms use the functionality of these dll's they are dynamically linked.
So your filesize stays small and in case of fixes within the dll you dont have to recompile your program.
If you dont want this behaviour you can set in the projectsettings the dll's to "static linked" (/MT). That way they will be compiled into your executable
Here is a relevant MSDN-article
Try to set /MT
for Release and /MTd
for Debug in Project Settings->C/C++->Code Generation
. This will make your program not dependent on Visual Studio libraries. But beware that all the libraries/ projects you will link with should also have the same option there, otherwise you'll get nasty linker errors.
You may also wish to select v120_xp
in General->Platform Toolset
for your program to be able to run on Windows XP