Ivan Prodanov
Ivan Prodanov

Reputation: 35522

C++ runtime required?

Why do some C++ projects require a runtime package to be installed, while others do not?

EDIT:How to make a project to work without the runtime?

Upvotes: 3

Views: 582

Answers (4)

Jesus Fernandez
Jesus Fernandez

Reputation: 1290

Some applications are built linking with the system libraries this are the dynamic linked programs. Other programs contains the code of the libraries into the executable file this are the static linked programs.

Pros of dynamic linked:

  • Smaller size of the program executable.
  • Less memory consumption if the dynamically linked library is shared.
  • Better performance.

Cons of dynamic linked:

  • Dependency on the library.
  • Deployment is more dificult.

Pros of static linked:

  • No dependencies.
  • Easier deployment of the application.

Cons of static linked:

  • The executable file is bigger.

To get a static project you need to set up the option in the project properties.

Upvotes: 2

Cătălin Pitiș
Cătălin Pitiș

Reputation: 14341

You need to have runtime package installed in case you are working with standard C/C++ library linked as DLL, and not as static library. So one way to avoid it is to link standard C/C++ library statically (C++ project settings). It may, or may not be possible in your case.

If not, you can use dependency walker tool from Visual Studio distribution to identify the DLLs needed by your application and just put them near your executable.

What you should be aware in Visual Studio 2005 and later is that there are the manifests for binaries can (and probably will :) make your life harder. Specially since SP1 for Visual Studio 2005 changes the version of C++ library, and the manifests as well.

Upvotes: 1

anon
anon

Reputation:

Some will have been statically linked, while others will depend on a dynamic library, loaded at run-time. To link your own project statically, you need to change your project configuration - how you do this depends on the compiler/linker and/or IDE you are using.

Upvotes: 8

gbjbaanb
gbjbaanb

Reputation: 52679

I think this refers to the VS2005 service pack 1 runtime. For some reason MS added some non-backward compatible features to it, so any app built with VS2005sp1 requires the runtime to go with it.

Upvotes: 1

Related Questions