Visual C++的正統(tǒng)做法是使用DLL版本運行庫。運行庫分發(fā)方法有兩種,一種方法是直接附帶DLL,另一種方法是使用vcredist_x86.exe。 如果不想使用DLL版本運行庫,而是想靜態(tài)編譯的話,可以更改項目屬性,將Release版/MD開關改為/MT,Debug版/MDd開關改為/MTd。但是靜態(tài)編譯有限制,不能跨DLL申請或釋放堆內存,也不能使用/clr編譯為托管程序集。 Visual C++ 2015微軟作了一個死,導致在Windows XP/7/8.1等老系統(tǒng)上需要附帶一堆DLL。如果不想附帶這么多DLL,有三種方法:
Visual C++ 2005/2008(以2008為例) Release版:C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT Debug版:C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\Debug_NonRedist\x86\Microsoft.VC90.DebugCRT 以Release為例,一共有四個文件:
其它文件夾還有:
Visual C++ 2010/2012/2013(以2012為例) Release版:C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\redist\x86\Microsoft.VC110.CRT Debug版:C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\redist\Debug_NonRedist\x86\Microsoft.VC110.DebugCRT 以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\Microsoft.VC140.CRT Debug版:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\Debug_NonRedist\x86\Microsoft.VC140.DebugCRT
其它文件夾還有:
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
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 VC++6.0的DLL |
|