引用 amo:其实是因为Windows 2000以后VC6运行库msvcrt.dll变成了Windows内部DLL(KnownDLL)的原因。msvcp60.dll和msvcirt.dll虽然还带,但是系统并没有使用,因为编译器早就换了几代了,C++不兼容了。
我还在用老古董VC6,没有这些烦恼……
Visual C++的正统做法是使用DLL版本运行库。运行库分发方法有两种,一种方法是直接附带DLL,另一种方法是使用vcredist_x86.exe。
如果不想使用DLL版本运行库,而是想静态编译的话,可以更改项目属性,将Release版/MD开关改为/MT,Debug版/MDd开关改为/MTd。但是静态编译有限制,不能跨DLL申请或释放堆内存,也不能使用/clr编译为托管程序集。
Visual C++ 2015微软作了一个死,导致在Windows XP/7/8.1等老系统上需要附带一堆DLL。如果不想附带这么多DLL,有三种方法:
Visual C++ 2005/2008(以2008为例)
Release版:C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\x86\XXXXXXXXXXXXXXXXXT
Debug版:C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\Debug_NonRedist\x86\XXXXXXXXXXXXXXXXXbugCRT
以Release为例,一共有四个文件:
其它文件夹还有:
Visual C++ 2010/2012/2013(以2012为例)
Release版:C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\redist\x86\XXXXXXXXXXXXXXXXXXT
Debug版:C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\redist\Debug_NonRedist\x86\XXXXXXXXXXXXXXXXXXbugCRT
以Release为例:
其它文件夹还有:
Visual C++ 2015
VC++2015对C/C++运行库进行了巨大的改造,分成了两部分:C/C++运行库和Universal CRT DLLs。在Windows XP/7/8.1上需要第一部分和第二部分,在Windows 10上仅需要第一部分。
C/C++运行库
Release版:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\x86\XXXXXXXXXXXXXXXXXXT
Debug版:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\Debug_NonRedist\x86\XXXXXXXXXXXXXXXXXXbugCRT
其它文件夹还有:
Universal CRT DLLs(获取这些DLL需安装Windows 10 SDK 10586+)
Release版:C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86
Debug版:C:\Program Files (x86)\Windows Kits\10\bin\x86\ucrt
<code class="language-txt">api-ms-win-core-console-l1-1-0.dll api-ms-win-core-datetime-l1-1-0.dll api-ms-win-core-debug-l1-1-0.dll api-ms-win-core-errorhandling-l1-1-0.dll api-ms-win-core-file-l1-1-0.dll api-ms-win-core-file-l1-2-0.dll api-ms-win-core-file-l2-1-0.dll api-ms-win-core-handle-l1-1-0.dll api-ms-win-core-heap-l1-1-0.dll api-ms-win-core-interlocked-l1-1-0.dll api-ms-win-core-libraryloader-l1-1-0.dll api-ms-win-core-localization-l1-2-0.dll api-ms-win-core-memory-l1-1-0.dll api-ms-win-core-namedpipe-l1-1-0.dll api-ms-win-core-processenvironment-l1-1-0.dll api-ms-win-core-processthreads-l1-1-0.dll api-ms-win-core-processthreads-l1-1-1.dll api-ms-win-core-profile-l1-1-0.dll api-ms-win-core-rtlsupport-l1-1-0.dll api-ms-win-core-string-l1-1-0.dll api-ms-win-core-synch-l1-1-0.dll api-ms-win-core-synch-l1-2-0.dll api-ms-win-core-sysinfo-l1-1-0.dll api-ms-win-core-timezone-l1-1-0.dll api-ms-win-core-util-l1-1-0.dll api-ms-win-crt-conio-l1-1-0.dll api-ms-win-crt-convert-l1-1-0.dll api-ms-win-crt-environment-l1-1-0.dll api-ms-win-crt-filesystem-l1-1-0.dll api-ms-win-crt-heap-l1-1-0.dll api-ms-win-crt-locale-l1-1-0.dll api-ms-win-crt-math-l1-1-0.dll api-ms-win-crt-multibyte-l1-1-0.dll api-ms-win-crt-private-l1-1-0.dll api-ms-win-crt-process-l1-1-0.dll api-ms-win-crt-runtime-l1-1-0.dll api-ms-win-crt-stdio-l1-1-0.dll api-ms-win-crt-string-l1-1-0.dll api-ms-win-crt-time-l1-1-0.dll api-ms-win-crt-utility-l1-1-0.dll ucrtbase.dll </code>
[修改于 7年11个月前 - 2017/01/11 23:04:11]
引用 amo:其实是因为Windows 2000以后VC6运行库msvcrt.dll变成了Windows内部DLL(KnownDLL)的原因。msvcp60.dll和msvcirt.dll虽然还带,但是系统并没有使用,因为编译器早就换了几代了,C++不兼容了。
我还在用老古董VC6,没有这些烦恼……
时段 | 个数 |
---|---|
{{f.startingTime}}点 - {{f.endTime}}点 | {{f.fileCount}} |
200字以内,仅用于支线交流,主线讨论请采用回复功能。