32-bit VC++ redistributable on 64 bit OS?

2019-01-25 23:02发布

问题:

Using Visual Studio, I have built an C++ application running in 32bit. It will be deployed both to 32-bit and 64-bit Windows servers. It won't be run in 64-bit mode (but rather under WoW).

Should I include both the 32-bit and 64-bit Visual C++ redistributable, and install 32bit on 32bit Windows and 64bit on 64 bit Windows, or is it enough to just install the 32bit redistributable?

回答1:

It is enough to install the 32bit redistributable.



回答2:

This is not an answer. It should only be a comment, but since I don't have the required reputation for that...:

I just wanted to warn people against Ruel's provided information. No, the 64-bit Visual C++ redistributable packages don't also include the 32-bit DLLs.

I have even tested that (his) theory. I tried to run an application that requires Visual C++ 2010 32-bit redistributables and it prompted me that it needs that. I then installed the 64-bit one, and it still prompted it needed the 32 bit version of Visual C++ 2010. After installing the 32 bit one, it worked.

Why people come up with theories and provide them as answers beats me. Or maybe he was also "encouraged" by the reputation system to give not only superfluous, but also false information. Or maybe he just confused C++ with DirectX 9 redistributables (that one does install both 32-bit and 64-bit DLLs).



回答3:

Both are Microsoft products, but don't let that fool you.

Your C++ application creates a 32 bits EXE, linking to 32 bits DLLs. As it happens, one or two of those DLLs are Microsoft CRT DLLs, but the OS still uses the same rules. Therefore, you don't need the 64 bits DLLs.



回答4:

Compile it using /MT option and VC++ runtime library will be compiled into your exe, so you don't have to worry about distributing it.

Project > Properties > Configuration Properties > C/C++ > Code Generation > Runtime Library > Multi-threaded (/MT).



回答5:

The 64-bit Visual C++ redistributable package includes both 32-bit Visual C++ redistributable and 64-bit Visual C++ redistributable.