Why do we need the Visual C ++ Redistributable Package?

If the code compiled by the visual C ++ compiler is direct C ++, why do we need a redistributable package? Does this mean that your code platform is dependent? Does the C ++ visual compiler with the redistributable package take any advantage over using another IDE with g ++?

+7
source share
5 answers

The code is platform independent, the resulting executable . It is associated with MS libraries with a standard library implementation, which are included in redistributable DLLs.

IIRC should be an option for statically linking everything, so you don’t need additional redistributable, but the resulting binary will still be platform dependent - for example, you cannot run the Windows binary on UNIX (without WINE).

+6
source

There is no such thing as "Straight C ++". There will always be some library functions that you call here and there in your code, and even if you are very careful, there will not be any functions that need to be called simply by the code emitted by the compiler. For example, if you have the following loop:

for( int i = 0; i < count; i++ ) array1[i] = array2[i]; 

The compiler will replace it with code that simply copies the memory. And if you compile for a smaller size instead of speed, it will be a function call very similar to memmove ().

In addition, you may have floating point operations for which there are no direct equivalent x86 commands; they will also be implemented using function calls. And this list goes on.

This does not mean that your platform is platform dependent, because on another platform the compiler of this plafrom will compile the same code to go with what is the C ++ runtime environment for this platform.

Fortunately, the C ++ runtime does not have to be a separate entity from your application. Check the compiler and linker options; You should be able to create one executable file that contains both. If you find that g ++ does not require a separate runtime, this is because it does this by default.

+5
source

The redistributable C ++ are specific to the IDEs you use ("IDE", I say, but it is really specific to the compiler, but for the IDE and the compiler both versions are assigned new versions as things move.)

This is done specifically for this development environment, but not for the Win OS. Thus, it should be backward compatible (assuming you are not using the new APIs, obviously.) In fact, this is done so that it is backward compatible (and not vice versa, as you think). This allows you to use the latter (10, 11, 12 ...) and still run your code on Win2k!

Now, of course, this is very different from Linux, where you still have to recompile every major version. Most Unix systems will do just that.

I don't know how to compile C ++ statically to avoid these redistributable resources. It may be possible, although it will certainly make your .exe very large.

+1
source

I always keep a copy of Visual C ++ 6 installed on the xp virtual machine (Wont works correctly in Win 6/7/8). Sometimes I write or ask to write a utility application to execute something fast and / or after I compile as one exe. I am tired of sending a simple program written using only std lib to someone else, just so that they tell me that this does not work due to a missing dll library or redistributable package.

0
source

In your project properties, C / C ++, code generation, install the Runtime library in / MT for your build version.

(Credits to Mike Dyns who answered this question in social.msdn: https://social.msdn.microsoft.com/Forums/vstudio/en-US/09afd4be-7a15-4772-98c1-a0464a96cd7f/how-to-static -linkage-in-visual-c-express-edition-2010? forum = vcgeneral & prof = required )

0
source

All Articles