Microsoft Visual C++

本页使用了标题或全文手工转换
维基百科,自由的百科全书
Visual C++
開發者微软公司
首次发布1993年2月,​31年前​(1993-02[1]
当前版本
  • 14.38.33135 (穩定版本)
編輯維基數據鏈接
操作系统Microsoft Windows
平台x86x86-64Itanium
语言英语法语德语西班牙语俄语意大利语韩语日语汉语(另有捷克语葡萄牙语(巴西)、波兰语土耳其语仅提供语言包)[2]
类型集成开发环境
许可协议微软最终用户许可协议
网站learn.microsoft.com/zh-cn/cpp/

Microsoft Visual C++(简称Visual C++MSVCVC++VC)是微軟公司C++開發工具,具有集成开发环境,可提供編輯C语言C++以及C++/CLI编程语言。VC++整合了便利的除錯工具,特別是整合了微軟Windows操作系统应用程序接口(Windows API)、三维動畫DirectX API,微软.NET框架。目前最新的版本是Microsoft Visual C++ 2022。

風格

Visual C++以拥有语法高亮IntelliSense(智能提示)以及高级调试功能而著称。比如,它允许用户进行远程调试,单步执行等。还有允许用户在调试期间重新编译被修改的代码,而不必重新启动正在调试的程序。其编译及创建預編譯頭文件(stdafx.h)、最小重建功能及累加連結(link)著稱。這些特徵明顯縮短程式編輯、編譯及連結的時間花費,在大型軟體計畫上尤其顯著。

发行版本

Visual C++被整合在Visual Studio之中,但仍可單獨安裝使用。

通常细分为多个发行版本。以Visual C++ 2013为例:

  • Visual C++ 2013 Community社群版(功能同專業版)(非商業免費)
  • Visual C++ 2013 Express速成版
  • Visual C++ 2013 Professional专业版
  • Visual C++ 2013 Premium高级版
  • Visual C++ 2013 Ultimate旗舰版

其中Microsoft Visual C++ 2013 Express可從MSDN的網站免費下載使用,並且不限制商業使用(但不包含MFC)。

歷史

微软的C/C++编译器有一个内置的宏_MSC_VER来表示编译器的当前版本。[3]

Visual C++的前身是Microsoft C/C++。还有相关产品:Microsoft QuickC 2.5 与Microsoft Quick C for Windows 1.0. Visual C++ 编译器仍然叫做Microsoft C/C++。例如Visual C++ 2015 Update 2的版本号是19.00.23918.

VC++, MFC 和 ATL的版本历史
产品 Codename 发布日期 C++版本 _MSC_VER MFC版本 _MFC_VER ATL版本 _ATL_VER 注释
16-bit版本
MSC 1.0 1983年10月 100 基于Lattice C, Microsoft的第一款C产品。遵循K&R C语言标准。售价500美元。
MSC 2.0 200 增加了large model支持
MSC 3.0 1985年 300 第一款Microsoft自己开发的C产品. 目标是兼容K&R与ANSI标准。1984年初微软用它开发了WindowsXenix
MSC 4.0 400 增加了优化器与源级调试器CodeView
MSC 5.0 500 增加了循环优化与Huge Model (数组大于64k)支持。Microsoft Fortran与80386上第一款32位编译器也是此计划的一部分。
Microsoft C 5.1 Optimizing Compiler 1988年 允许OS/2 1.x编译
MSC 6.0 1989年 600 增加了全局流分析、源浏览器、新调试器、可选的C++前端.[4]
MS C/C++ 7.0 1992年 700 1.0 0x0100 内建支持C++与MFC 1.0.[5]
Visual C++ 1.0 Caviar 1993年2月22日 1.0 800 2.0 0x0200 Cfront 2.1 兼容[6]。IDE称“Visual Workbench”。有两个版本:[1]
    • Standard – 替换“QuickC for Windows”。售价199美元。
    • Professional – 替换 C/C++ 7.0. 可建构 DOS与Windows应用程序。包含了优化编译器、源profiler, Windows 3.1 SDK。[6]以及Phar Lap 286 DOS Extender Lite[7]售价499美元。
Visual C++ 1.1 Barracuda 1993 1.1
Visual C++ 1.5 Dolphin 1993年12月 1.5 850 2.5 0x0250 增加了OLE 2.0与ODBC 支持.[8] 是首款仅用CD-ROM发布的Visual C++.這個版本-{只}支持16位开发。
Visual C++ 1.51 1.5 作为subscription service可利用
Visual C++ 1.52 1.52 作为subscription service可利用
Visual C++ 1.52b 1.52b 类似于1.52, 但不包括Control Development Kit
'Visual C++ 1.52c 1.52c 是1.5的加补丁版. 是最后一版,也是有争议的最为流行的Microsoft Windows 3.x开发平台. 可通过Microsoft Developer Network使用它
32-bit版本
Visual C++ 1.0 最初称Visual C++ 32-bit Edition[9] 1993年7月发布时,已经有了16位的VC++ 1.5,但这个版本不支持OLE2与ODBC. 套装叫做Visual C++ 16/32-bit Suite, 其中包含了Visual C++ 1.5.[10]
Visual C++ 2.0 2.0 900 3.0 0x0300 第一個只發行32位的版本。這個版本提前發行了,幾乎成了一個「丟失的版本」。這是因為那個時候Windows 95(開發代碼為"Chicago")還沒有發行,而Windows NT又只佔有很小的市場份額。該版本用戶可以通過微軟公司的訂閱服務(Microsoft Subscription Service)升級至2.1和2.2版本。微軟公司在這個版本中还包含了升級后的Visual C++ 1.5:2.0版本中包含了Visual C++ 1.51;2.1版本包含了Visual C++ 1.52。Visual C++ 2.x附帶了16位和32位版本的CDK,同時支持Win32s的開發。Visual C++ 2.2及其後續版本不再升級Visual C++ 1.5(儘管它一直被集成至Visual C++ 4.x)。儘管出生的比Windows 95早,這個版本的發行日期還是非常接近Windows 95,可是當Windows 95發行時,Visual C++ 4.0也已經發行了。因此很多程序開發者直接從1.x過渡到4.0,把2.x跳過去了。
Visual C++ 2.1 2.1 可通过订阅服务获得
Visual C++ 2.2 2.2 可通过订阅服务获得
Visual C++ 4.0 Olympus 1995-12-11 4.0 1000 4.0 0x0400 为与MFC版本号对齐,跳过了VC++3.0版本号。專門為Windows 95以及Windows NT設計的。[11],引入了Developer Studio IDE,[12]用戶可以通過微軟公司的訂閱服務(Microsoft Subscription Service)升級至4.1版本(包含Microsoft Game SDK)和4.2版本(此版本不再支持Win32s開發)。 为支持老的(Windows 3.x/DOS)项目,还包含了Visual C++ 1.52安装光盘。 VC++ 3.0版本号被跳过,以与MFC 4.0的版本号相同.[13]
Visual C++ 4.2 4.2 1020 4.2 0x0420 Developer Studio 4.2
Visual C++ 5.0 Boston 1997-04-28 5.0 1100 4.21 0x0421 2.1 0x0210 Visual Studio 97是第一个集成了多个产品 (Visual C++, Visual Basic, Visual J++)。是4.2版以來比較大的一次升級。[14]包含了四个版本:
Visual C++ 6.0 Aspen 1998年8月 6.0 1200 6.0 0x0600 3.0 0x0300 Visual Studio 6.0是惟一不用年份命名的Visual Studio。 MFC DLL的名字没有改变,还是叫做mfc42.dll。發行至今一直被廣泛地用於大大小小的項目開發。[19]但是,這個版本在Windows XP下運行會出現問題,尤其是在調試模式的情況下(例如:靜態變量的值並不會顯示)。這個調試問題可以通過打一個叫「Visual C++ 6.0 Processor Pack」的補丁來解決。奇怪的是,這個網頁強調用戶也必須運行Windows 98、Windows NT 4.0、或Windows 2000。版本号12.00.8804
Visual C++ .NET 2002 Rainier 2002年 7.0 1300 7.0 0x0700 7.0 0x0700 支持鏈接時代碼生成調試執行時檢查。這個版本還集成了Managed Extension for C++,以及一個全新的用戶界面(與Visual BasicVisual C#共用)。這也是為什麼Visual C++ 6.0仍然被廣泛使用的一個主要原因。版本号13.00.9466
Visual C++ .NET 2003 Everett 2003年 7.1 1310 7.1 0x0710 7.1 0x0710 类似于1.52, 但不包括Control Development Kit
eMbedded Visual C++ 用於Windows CE操作系统。[20]Visual C++作為一個獨立的開發環境被Microsoft Visual Studio 2005所替代。
32-bit/64-bit版本
Visual C++ 2005 Whidbey 2005年11月 8.0 1400 8.0 0x0800 8.0 0x0800 引進了全新版本的C++/CLI語言以替换Managed C++,以及OpenMP的支持
Visual C++ 2008 Orcas 2007年11月 9.0 1500 9.0 0x0900 9.0 0x0900 支持.NET 3.5。Visual Studio 2008 Team Suite更同時支援x64與IA-64編譯
Visual C++ 2010 Dev10 2010年4月12日 10.0 1600 10.0 0x0A00 10.0 0x0A00 Visual C++開發團隊考慮使用SQL Server Compact格式的資料庫來儲存源碼的相關資訊[21].本版也加入了現代化的C++并行運算庫-Parallel Patterns Library,部分支援C++0x。本版建構於.NET 4.0之上,但仍支持機器碼的編譯。
Visual C++ 2012 Dev11 2012年8月15日 11.0 1700 11.0 0x0B00 11.0 0x0B00 支持Windows Runtime开发。[22]从该版本起,编译出的32位程序不能在Windows NT4.0 / 2000 / XP上运行,这是因为在程序内部使用了自Vista起出现在kernel32.dll中的GetTickCount64函数。解决办法是在编译project的platform set选择为“Visual Studio 2012 - Windows XP (v110_xp) ”。
Visual C++ 2013 Dev12 2013年10月17日 12.0 1800 12.0 0x0C00 12.0 0x0C00 支持C++11C99特性,并引入了REST SDK。[23]
    • RTM version number: 18.0.21005.1
    • Update 2 version number: 18.00.30501
Visual C++ 2015 Dev14 2015年7月20日 14.0 1900 14.0 0x0E00 14.0 0x0E00 改进了对C++11/14支持。[24][25]
Visual C++ 2017 Dev15 2017年3月7日 14.10 1910 14.10 0x0E00 14.10 0x0E00 从此版本开始,MSVC++版本号与Visual Studio版本号不再同步,并且每个子版本都会递增

MSVC++ 14.0 _MSC_VER == 1900 (Visual Studio 2015 version 14.0)。开始支持C++17[26]

Visual C++ 2019 Dev16 2019年4月2日 14.20 1920 14.20 0x0E00 14.20 0x0E00 开始支持C++20[27]

语言标准支持

C99

在Visual C++ 2012以前,完全不支持C99C11的新特性,仅支持1989年版的ANSI C[28]Visual C++ 2012开始在C模式下支持C99的部分特性,如designated initializers、compound literals、_Bool类型。Visual C++ 2013很大改进了对C99特性的支持。[29] Visual C++ 2015基本上完整支持了C99标准库,但需要编译器尚未支持的C99语言特性的那部分标准库除外。[30]

C++

至VC++2017 Version 15.7已经完全实现了C++17

详细情况见[31]

工具链生态环境

  • Universal CRT (UCRT)包含了C99运行时库的函数与全局变量。UCRT现在是Windows component,随Windows 10安装。UCRT的静态库、DLL的导入库、头文件是Windows 10 SDK的一部分。
  • vcruntime库包含Visual C++ CRT实现相关的代码,如异常处理、调试支持、运行时检查、类型信息、实现细节与特定扩展库函数。 vcruntime库相关于特定编译器。
  • CRT(C 运行时库)初始化库处理进程启动(CRT startup)、内部的逐线程的初始化、终止。CRT初始化库相关于特定编译器。CRT初始化库总是静态链接,即使使用了动态链接的UCRT。
  • 对于本地代码与受管代码混合的情形,使用/clr编译选项,这会动态链接 UCRT与vcruntime,静态链接msvcmrt.lib或msvcmrtd.lib;msvcmrt.lib或msvcmrtd.lib提供了受管代码与本地CRT之间的proxy。对于纯受管代码情形,使用/clr:pure编译选项,这会静态链接msvcurt.lib或msvcurtd.lib。
  • msvcmrt.lib、msvcmrtd.lib,用于 DLL UCRT 和 vcruntime 的混合本机和托管 CRT 启动的调试版本的静态库。不可再分发。
  • UCRT现在是一个 Windows 组件,并作为 Windows 10 及更高版本的一部分提供。UCRT 的静态库、DLL 导入库和头文件现在可以在 Windows SDK 中找到[32]

编译时,根据项目是调试版还是发布版,动态还是静态链接运行时库,编译器可自动使用默认库。如果使用编译选项/nodefaultlib,需要显式指定使用的库。对于VC++2015,所有下述库均为多线程:[33]

情形 编译选项 预处理directives CRT初始化库
(均为静态链接)
vcruntime库 vcruntime DLL Universal CRT UCRT DLL Standard C++库
Release DLLs /MD _MT, _DLL msvcrt.lib vcruntime.lib vcruntime<version>.dll ucrt.lib ucrtbase.dll MSVCPRT.LIB
是MSVCP<version>.dll的输入库
Debug DLLs /MDd _DEBUG, _MT, _DLL msvcrtd.lib vcruntimed.lib vcruntime<version>d.dll ucrtd.lib ucrtbased.dll MSVCPRTD.LIB
是MSVCP<version>D.dll的输入库
Release Static /MT _MT libcmt.lib libvcruntime.lib None libucrt.lib None LIBCPMT.LIB
Debug Static /MTd _DEBUG, _MT libcmtd.lib libvcruntimed.lib None libucrtd.lib None LIBCPMTD.LIB
Mixed Release Static /clr _MT msvcmrt.lib
Mixed Debug Static /clr _MT msvcmrtd.lib
Pure Release Static(过时) /clr:pure _MT msvcurt.lib
Pure Debug Static(过时) /clr:pure _MT msvcurtd.lib

Visual C++运行时库

Visual C++编译出的应用程序,其运行环境通常需要安装Visual C++运行时库。官方下载网址见[34]

Visual C++ Build tools

Microsoft C++ Build Tools是一套MSVC工具集,通过可脚本化、单独安装器,而不需要Visual Studio。如果你通过命令行方式开发程序可以使用这套工具。

历史版本支持

从2021年4月26日开始,Visual Studio 2015和更老版本的web安装器文件被从Microsoft Download Center删除。[35] 这些古老的产品可从 “Downloads - Visual Studio Subscriptions Portal”下载后用ISO images安装。

參見

参考文献

  1. ^ 1.0 1.1 Visual C++ adds Windows support. InfoWorld. 1993-02-22: 17. 
  2. ^ Microsoft Visual Studio 2012下载页面. [2017-04-13]. (原始内容存档于2013-11-12). 
  3. ^ Pre-defined Compiler Macros / Wiki / Compilers. sourceforge.net. [2016-02-11]. (原始内容存档于2020-11-11). 
  4. ^ Ladd, Scott Robert. Optimizing With Microsoft C 6.0. 1990-08-01 [2016-11-28]. (原始内容存档于2017-03-20). 
  5. ^ Retrieved from http://support.microsoft.com/kb/196831页面存档备份,存于互联网档案馆).
  6. ^ 6.0 6.1 Visual C++ is a strong development tool. InfoWorld. 1993-06-21: 94 [2017-04-13]. (原始内容存档于2020-08-05). 
  7. ^ Rival DOS Extenders debut at show. InfoWorld. 1993-03-01: 18. 
  8. ^ Visual C++ 1.5 integrates OLE, ODBC. InfoWorld. 1993-11-08: 5 [2017-04-13]. (原始内容存档于2020-08-05). 
  9. ^ Microsoft set to prerelease 32-bit Visual C++. InfoWorld. 1993-07-19: 12. 
  10. ^ C++ IDEs evolve. InfoWorld. 1994-04-04: 79. 
  11. ^ Obsolete Products. [2017-04-13]. (原始内容存档于2005-08-14). 
  12. ^ Toth, Viktor. 1. Visual C++ 4.0 unleashed. Indianapolis: SAMS Publishing. 1996 [2013-07-26]. ISBN 9780672308741. (原始内容存档于2019-08-11). 
  13. ^ History of Visual Studio (Part 3). [2017-04-13]. (原始内容存档于2009-10-11). 
  14. ^ Major Changes from Visual C++ 4.2 to 5.0. [2017-04-13]. (原始内容存档于2015-08-28). 
  15. ^ Microsoft Visual C++ 5.0 Learning Edition. [2017-04-13]. (原始内容存档于1999-04-27). 
  16. ^ Microsoft Visual C++ 5.0 Professional Edition. [2017-04-13]. (原始内容存档于1999-04-27). 
  17. ^ Microsoft Visual C++ 5.0 Enterprise Edition. [2017-04-13]. (原始内容存档于1999-04-17). 
  18. ^ Microsoft Visual C++ 5.0 RISC Edition. [2017-04-13]. (原始内容存档于1999-04-29). 
  19. ^ Major Changes from Visual C++ 5.0 to 6.0. [2017-04-13]. (原始内容存档于2008-09-14). 
  20. ^ Douglas Boling :Programming Microsoft Windows CE .NET, Third Edition Microsoft Press; 3rd edition (June 25, 2003) Paperback: 1264 pages ISBN 978-0735618848 - Companion CD with Microsoft eMbedded Visual C++ 4.0 Service Pack 2 Archive.is存檔,存档日期2013-02-11
  21. ^ Visual C++ Team Blog. IntelliSense, part 2: The Future. [2008-03-12]. (原始内容存档于2010-03-11). 
  22. ^ What's New for Visual C++ in Visual Studio 2012. Microsoft Developer Network. Microsoft. [2015-09-20]. (原始内容存档于2015-09-23). 
  23. ^ What's New for Visual C++ in Visual Studio 2013. Microsoft Developer Network. Miicrosoft. [2015-09-20]. (原始内容存档于2015-05-23). 
  24. ^ Stephan T. Lavavej. C++11/14/17 Features In VS 2015 RTM. Visual C++ Team Blog. Microsoft. 2015-06-19 [2017-04-13]. (原始内容存档于2015-06-20). 
  25. ^ Eric Battalio. Visual Studio 2015 RTM Now Available. Visual C++ Team Blog. Microsoft. 2015-07-20 [2017-04-13]. (原始内容存档于2015-07-22). 
  26. ^ John. Visual Studio 2017: Productivity, Performance, and Partners. Visual Studio Blog. Microsoft. 2017-03-07 [2020-08-14]. (原始内容存档于2020-09-19). 
  27. ^ John. Visual Studio 2019: Code faster. Work smarter. Create the future.. Visual Studio Blog. Microsoft. 2019-04-02 [2020-08-14]. (原始内容存档于2021-01-29) (美国英语). 
  28. ^ C99 support. Microsoft Connect. [2017-04-13]. (原始内容存档于2016-03-04). 
  29. ^ Pat Brenner. C99 library support in Visual Studio 2013. Visual C++ Team Blog. Microsoft. 2013-07-19 [2017-04-13]. (原始内容存档于2014-08-05). 
  30. ^ What's New for Visual C++ in Visual Studio 2015. Microsoft Developer Network. Microsoft. [2017-04-13]. (原始内容存档于2018-11-05). 
  31. ^ MSDN: Visual C++ Language Conformance. [2018-11-14]. (原始内容存档于2019-01-09). 
  32. ^ C runtime (CRT) and C++ Standard Library (STL) .lib files. [2022-04-03]. (原始内容存档于2021-11-23). 
  33. ^ Visual C++ Team Blog: "Introducing the Universal CRT". [2017-03-22]. (原始内容存档于2019-07-01). 
  34. ^ MSDN: The latest supported Visual C++ downloads. [2018-11-14]. (原始内容存档于2019-08-10). 
  35. ^ MSDN:"UPDATE: SHA-1 signed content to be retired". [2022-08-09]. (原始内容存档于2022-08-09). 

外部連結