它是某些在Windows上的某些组中的常见投诉,在Windows上遍布文件系统和注册表,以及一些应用程序提供了简单地解压缩文件的选项,以便“卸载”只需删除。但它们如何避免Visual C ++重新舞剧,并排(SXS)等的所有丑陋?

我有一点实用程序,真的我更愿意分发一个运行的单个.exe - 没有安装程序,因为它很小。这是可行的吗?

编辑: 如图所示,我尝试使用静态依赖性的运行时间(/ mt而不是/ md)构建。我得到了以下(中间部分被截断为清晰度):

1>Linking...
1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _free already defined in LIBCMT.lib(free.obj)
1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _malloc already defined in LIBCMT.lib(malloc.obj)
1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: __mbschr already defined in LIBCMT.lib(mbschr.obj)
1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _realloc already defined in LIBCMT.lib(realloc.obj)
1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: __strdup already defined in LIBCMT.lib(strdup.obj)
1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _abort already defined in LIBCMT.lib(abort.obj)
1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: __stricmp already defined in LIBCMT.lib(stricmp.obj)
1>MSVCRT.lib(MSVCR90.dll) : error LNK2005: _setlocale already defined in LIBCMT.lib(setlocal.obj)
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
.

有帮助吗?

解决方案

You can distribute a single EXE if you statically link to the VC runtime - on the project's Property Page -> Configuration Properties -> C/C++ -> Code Generation and set "Runtime Library" to a "non-dll" option.

Depending on your target audience, distributing as a .exe may be problematic as .exe files are sometimes blocked from downloading in corporate environments, so providing a .zip file as well is advisable.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top