Different versions of C++ libraries

爷,独闯天下 提交于 2019-12-06 05:52:39

You need to install the Visual Studios 2008 runtime on the target computer:

http://www.microsoft.com/downloads/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&displaylang=en

Alternatively, you could also link the run time statically, in the project properties window go to:

c++ -> Code Generation -> Runtime Library and select "multi-threaded /MT"

You need to install the runtime redistributable files onto the machine you are trying to run the app on.

The redistributable for 2008 is here.

The redistributable for 2005 is here.

They can be installed side-by-side, in case you need both.

You probably need to distribute the VC runtime with your application. There are a variety of ways to do this. This article from the Microsoft Visual C++ Team best explains the different ways to distribute these dependencies if you are using Visual Studio 2005 or 2008.

As stated in the article, though you can download the Redistributable installer package and simply launch that on the client machine, that is almost always not the optimal option. There are usually better ways to include the required DLLs such as including the merge module if you are distributing via Windows Setup or App-Local copy if you just want to distribute a zipped folder.

Another option is to statically link against the runtime libraries, instead of distributing them with your application. This option is only suitable for standalone EXEs that do not load other DLLs. You also cannot do this with DLLs that are loaded by other applications.

It is much the simplest to link to the runtime statically.

c++ -> Code Generation -> Runtime Library and select "multi-threaded /MT"

However, this does make your executable a couple hundred KByte larger. This might be a problem if you are installing a large number of small programs, since each will be burdened by its very own copy of the runtime. The answer is to create an installer.

New project -> "setup and deployment" -> "setup project"

Load the output from your application projects ( defined using the DLL version of the runtime ) into the installer project and build it. The dependency on the runtime DLL will be noticed, included in the installer package, and neatly and unobtrusively installed in the correct place on the target machine.

Visual studio 2005 actually has two

The one for the original release

and the one for SP1

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