Applications written using the Visual C ++ xxxx (XXXX stands for 2010, etc.) compilerProgramTo enable it to run on the target computer without the Visual C ++ XXXX compiler installed, you must install the corresponding Microsoft Visual C ++ XXXX Runtime library on the target computer. After installation, runtime support for C, standard C ++, ATL, MFC, OpenMP, and msdia class libraries will be provided. For example, to run an application written in Visual C ++ 2008, you must install Microsoft Visual C ++ 2008 SP1 redistributable package on the target computer.
When we search and download Microsoft Visual C ++ XXXX redistributable on Microsoft's official website, we will find many different versions, the following uses Microsoft Visual C ++ 2008 redistributable as an example to describe common versions.
Common Microsoft Visual C ++ 2008 redistributable versions are as follows:
Microsoft Visual C ++ 2008 SP1 redistributable package (x86)
Microsoft Visual C ++ 2008 SP1 redistributable package (x64)
Microsoft Visual C ++ 2008 redistributable package (x86)
Microsoft Visual C ++ 2008 redistributable package (x64)
Where,X86Indicates applicable32Bit system,X64Indicates applicable64Bit system.
SP1The version number indicates the latest version. Therefore, we should install the latest version:SP1Version.
Note: 64 running on a bit Operating System 32 bit applications, also run 64 bit application, so in 64 On a bit operating system, 32 bit or 64 x86 version or x64 version visual c ++ Runtime Library.
If you run an application published by Microsoft Visual C ++ XXXX on a computer that does not have the Microsoft Visual C ++ XXXX Runtime Library installed, the following error is reported: the application cannot be started, because the application settings are incorrect, reinstall the application to fix this problem. Therefore, when you start a program, you can determine whether to install the corresponding visual c ++ Runtime library based on the error message.
In fact, we can also run the Visual C ++ XXXX application on the target computer without installing the Visual C ++ XXXX Runtime Library. The solution is only to use static links when compiling and linking an application. You can set the use MFC in a static library attribute, as shown in:
By default, all projects created using VC use dynamic links, that is, use MFC in a shared DLL.
when you set use MFC in a static library, the link application is compiled using static links. Although the target computer running the program does not need to install the corresponding visual c ++ Runtime Library, the static link will load the corresponding library files used to the generated application, the size of the generated executable file is significantly increased. More system resources are required during execution, and more time is consumed when the memory is loaded. (For example, I used Visual Studio 9.0 A simple MFC Dialog Box program, when dynamic links are used, the program size is 600kb , when static links are used, the program size is 2.16 MB ).
The static or dynamic link should be selected based on the actual situation. However, the dynamic link is usually selected and installed on the target computer where the program runs.Visual c ++Runtime Library.