{{short description|Integrated development environment product by Microsoft}}
{{Infobox software
| name = Visual C++
| logo = Visual_Studio_Icon_2022.svg
| developer = [[Microsoft]]
| released = {{Start date and age|1993|02}}<ref name="Visual C++ adds Windows support">{{cite news |title = Visual C++ adds Windows support |newspaper = InfoWorld |date = February 22, 1993 |page = 17 |url = https://books.google.com/books?id=vjsEAAAAMBAJ }}</ref>
| latest release version = 14.34.31938
| programming language = [[C++]]<ref>{{cite web|url=http://www.lextrait.com/Vincent/implementations.html |title=The Programming Languages Beacon, v10.0 |first=Vincent |last=Lextrait |date=January 2010 |access-date=14 March 2010 |url-status=dead |archive-url=https://archive.today/20120530/http://www.lextrait.com/Vincent/implementations.html |archive-date=30 May 2012 }}</ref>
| operating system = [[Windows]]
| platform = [[IA-32]], [[x86-64]] and [[ARM architecture|ARM]]
| language = English, Chinese (Simplified & Traditional), Czech, French, German, Italian, Japanese, Korean, Polish, Portuguese (Brazilian), Russian, Spanish, Turkish
| genre = [[Compiler]]
| license = [[Trialware]] and [[freeware]]
| website = {{URL|https://docs.microsoft.com/en-us/cpp/}}
}}
'''Microsoft Visual C++''' ('''MSVC''') is a compiler for the [[C (programming language)|C]], [[C++]], [[C++/CLI]] and [[C++/CX]] [[programming language]]s by [[Microsoft]]. MSVC is [[proprietary software]]; it was originally a standalone product but later became a part of [[Microsoft Visual Studio|Visual Studio]] and made available in both [[trialware]] and [[freeware]] forms. It features tools for [[Software development|developing]] and [[debugging]] C++ code, especially code written for the [[Windows API]], [[DirectX]] and [[.NET Framework|.NET]].
Many [[application software|applications]] require [[redistributable]] Visual C++ runtime library packages to function correctly. These packages are frequently installed separately from the applications they support, enabling multiple applications to use the package with only a single installation. These Visual C++ redistributable and runtime packages are mostly installed for standard [[Library (computing)|libraries]] that many applications use.<ref name="askleo">[http://ask-leo.com/do_i_need_these_microsoft_visual_c_redistributables.html "Do I need these Microsoft Visual C++ redistributables?"]. Ask Leo!. Retrieved 2012-11-18.</ref>
== History ==
The predecessor to Visual C++ was called ''Microsoft C/C++''. There was also a ''Microsoft [[QuickC]]'' 2.5 and a ''Microsoft QuickC for Windows'' 1.0. The Visual C++ [[compiler]] is still known as ''Microsoft C/C++'' and as of the release of Visual C++ 2015 Update 2, is on version 14.0.23918.0.{{cn|date=May 2021}}
=== 16-bit versions ===
=== Strictly 32-bit versions ===
=== 32-bit and 64-bit versions ===
=== Internal version numbering ===
There are several different version numbers to consider when working with Visual C or C++. The oldest and most original of these is the compiler version number, which has been monotonically increased since the early Microsoft C compiler days. This is the version returned by running the command cl.exe on its own without any options. By taking two digits after the decimal and dropping the decimal point, this also becomes the value of the C pre-processor macro: _MSC_VER, and the CMake variable: MSVC_VERSION. A longer version of the C macro is _MSC_FULL_VER to make more finely-grained distinctions between builds of the compiler. An example of _MSC_VER is '1933' to represent version 19.33 of the Microsoft C/C++ compiler, and of _MSC_FULL_VER is '193331630'. You should use the >= operator to test the value of _MSC_VER or _MSC_FULL_VER instead of equality.
The Visual product version, such as '17.3.4', designates the version of Visual Studio with which version 19.33 of the compiler was packaged. Then there is the Microsoft Visual C/C++ Runtime Library version, e.g. '14.3'. From this, one can deduce also the toolset version, which can be obtained by taking the first three digits of the runtime library version and dropping the decimal, e.g. '143'. It includes the Visual C/C++ runtime library, as well as compilers, linkers, assemblers, other build tools, and matching libraries and header files. The following is a (scrapeable) table of the known correlated version numbers.
{| class="wikitable"
|+ Visual Studio Versions
! product name !! product Version !! marketing year !! _MSC_VER !! _MSC_FULL_VER !! runtime library version
|-
| Microsoft C 6.0 || || || 600 || ||
|-
| Microsoft C/C++ 7.0 || || || 700 || ||
|-
| Visual C++ 1.0 || 1.0 || || 800 || || 1
|-
| Visual C++ 2.0 || 2.0 || || 900 || || 2
|-
| Visual C++ 4.0 || 4.0 || || 1000 || || 4
|-
| Visual C++ 4.1 || 4.1 || || 1010 || || 4.1
|-
| Visual C++ 4.2 || 4.2 || || 1020 || || 4.2
|-
| Visual Studio 97 [5.0] || 5.0 || 97 || 1100 || || 5
|-
| Visual Studio 6.0 SP5 || 6.0 || || 1200 || 12008804 || 6
|-
| Visual Studio 6.0 SP6 || 6.0 || || 1200 || 12008804 || 6
|-
| Visual Studio .NET 2002 [7.0] || 7.0 || 2002 || 1300 || 13009466 || 7
|-
| Visual Studio .NET 2003 Beta [7.1] || 7.1 || 2003 || 1310 || 13102292 || 7.1
|-
| Visual Studio Toolkit 2003 [7.1] || 7.1 || 2003 || 1310 || 13103052 || 7.1
|-
| Visual Studio .NET 2003 [7.1] || 7.1 || 2003 || 1310 || 13103077 || 7.1
|-
| Visual Studio .NET 2003 SP1 [7.1] || 7.1 || 2003 || 1310 || 13106030 || 7.1
|-
| Visual Studio 2005 Beta 1 [8.0] || 8.0 || 2005 || 1400 || 140040607 || 8
|-
| Visual Studio 2005 Beta 2 [8.0] || 8.0 || 2005 || 1400 || 140050215 || 8
|-
| Visual Studio 2005 [8.0] || 8.0 || 2005 || 1400 || 140050320 || 8
|-
| Visual Studio 2005 SP1 [8.0] || 8.0 || 2005 || 1400 || 140050727 || 8
|-
| Visual Studio 2008 Beta 2 [9.0] || 8.0 || 2008 || 1500 || 150020706 || 9
|-
| Visual Studio 2008 [9.0] || 9.0 || 2010 || 1500 || 150021022 || 9
|-
| Visual Studio 2008 SP1 [9.0] || 9.0 || 2010 || 1500 || 150030729 || 9
|-
| Visual Studio 2010 Beta 1 [10.0] || 10.0 || 2010 || 1600 || 160020506 || 10
|-
| Visual Studio 2010 Beta 2 [10.0] || 10.0 || 2010 || 1600 || 160021003 || 10
|-
| Visual Studio 2010 [10.0] || 10.0 || 2010 || 1600 || 160030319 || 10
|-
| Visual Studio 2010 SP1 [10.0] || 10.0 || 2010 || 1600 || 160040219 || 10
|-
| Visual Studio 2012 [11.0] || 11.0 || 2012 || 1700 || 170050727 || 11
|-
| Visual Studio 2012 Update 1 [11.0] || 11.0 || 2012 || 1700 || 170051106 || 11
|-
| Visual Studio 2012 Update 2 [11.0] || 11.0 || 2012 || 1700 || 170060315 || 11
|-
| Visual Studio 2012 Update 3 [11.0] || 11.0 || 2012 || 1700 || 170060610 || 11
|-
| Visual Studio 2012 Update 4 [11.0] || 11.0 || 2012 || 1700 || 170061030 || 11
|-
| Visual Studio 2012 November CTP [11.0] || 11.0 || 2012 || 1700 || 170051025 || 11
|-
| Visual Studio 2013 Preview [12.0] || 12.0 || 2013 || 1800 || 180020617 || 12
|-
| Visual Studio 2013 RC [12.0] || 12.0 || 2013 || 1800 || 180020827 || 12
|-
| Visual Studio 2013 [12.0] || 12.0 || 2013 || 1800 || 180021005 || 12
|-
| Visual Studio 2013 Update 1 [12.0] || 12.0 || 2013 || 1800 || 180021005 || 12
|-
| Visual Studio 2013 Update2 RC [12.0] || 12.0 || 2013 || 1800 || 180030324 || 12
|-
| Visual Studio 2013 Update 2 [12.0] || 12.0 || 2013 || 1800 || 180030501 || 12
|-
| Visual Studio 2013 Update 3 [12.0] || 12.0 || 2013 || 1800 || 180030723 || 12
|-
| Visual Studio 2013 Update 4 [12.0] || 12.0 || 2013 || 1800 || 180031101 || 12
|-
| Visual Studio 2013 Update 5 [12.0] || 12.0 || 2013 || 1800 || 180040629 || 12
|-
| Visual Studio 2013 November CTP [12.0] || 12.0 || 2013 || 1800 || 180021114 || 12
|-
| Visual Studio 2015 [14.0] || 14.0 || 2015 || 1900 || 190023026 || 14
|-
| Visual Studio 2015 Update 1 [14.0] || 14.0 || 2015 || 1900 || 190023506 || 14
|-
| Visual Studio 2015 Update 2 [14.0] || 14.0 || 2015 || 1900 || 190023918 || 14
|-
| Visual Studio 2015 Update 3 [14.0] || 14.0 || 2015 || 1900 || 190024210 || 14
|-
| Visual Studio 2017 version 15.0 || 15.0 || 2017 || 1910 || 191025017 || 14.1
|-
| Visual Studio 2017 version 15.1 || 15.1 || 2017 || 1910 || 191025017 || 14.1
|-
| Visual Studio 2017 version 15.2 || 15.2 || 2017 || 1910 || 191025017 || 14.1
|-
| Visual Studio 2017 version 15.3.3 || 15.3.3 || 2017 || 1911 || 191125507 || 14.11
|-
| Visual Studio 2017 version 15.4.4 || 15.4.4 || 2017 || 1911 || 191125542 || 14.11
|-
| Visual Studio 2017 version 15.4.5 || 15.4.5 || 2017 || 1911 || 191125547 || 14.11
|-
| Visual Studio 2017 version 15.5.2 || 15.5.2 || 2017 || 1912 || 191225831 || 14.12
|-
| Visual Studio 2017 version 15.5.3 || 15.5.3 || 2017 || 1912 || 191225834 || 14.12
|-
| Visual Studio 2017 version 15.5.4 || 15.5.4 || 2017 || 1912 || 191225834 || 14.12
|-
| Visual Studio 2017 version 15.5.6 || 15.5.6 || 2017 || 1912 || 191225835 || 14.12
|-
| Visual Studio 2017 version 15.5.7 || 15.5.7 || 2017 || 1912 || 191225835 || 14.12
|-
| Visual Studio 2017 version 15.6.0 || 15.6.0 || 2017 || 1913 || 191326128 || 14.13
|-
| Visual Studio 2017 version 15.6.1 || 15.6.1 || 2017 || 1913 || 191326128 || 14.13
|-
| Visual Studio 2017 version 15.6.2 || 15.6.2 || 2017 || 1913 || 191326128 || 14.13
|-
| Visual Studio 2017 version 15.6.3 || 15.6.3 || 2017 || 1913 || 191326129 || 14.13
|-
| Visual Studio 2017 version 15.6.4 || 15.6.4 || 2017 || 1913 || 191326129 || 14.13
|-
| Visual Studio 2017 version 15.6.6 || 15.6.6 || 2017 || 1913 || 191326131 || 14.13
|-
| Visual Studio 2017 version 15.6.7 || 15.6.7 || 2017 || 1913 || 191326132 || 14.13
|-
| Visual Studio 2017 version 15.7.1 || 15.7.1 || 2017 || 1914 || 191426428 || 14.14
|-
| Visual Studio 2017 version 15.7.2 || 15.7.2 || 2017 || 1914 || 191426429 || 14.14
|-
| Visual Studio 2017 version 15.7.3 || 15.7.3 || 2017 || 1914 || 191426430 || 14.14
|-
| Visual Studio 2017 version 15.7.5 || 15.7.5 || 2017 || 1914 || 191426433 || 14.14
|-
| Visual Studio 2017 version 15.9.1 || 15.9.1 || 2017 || 1916 || 191627023 || 14.16
|-
| Visual Studio 2017 version 15.9.4 || 15.9.4 || 2017 || 1916 || 191627025 || 14.16
|-
| Visual Studio 2017 version 15.9.5 || 15.9.5 || 2017 || 1916 || 191627026 || 14.16
|-
| Visual Studio 2017 version 15.9.7 || 15.9.7 || 2017 || 1916 || 191627027 || 14.16
|-
| Visual Studio 2017 version 15.9.11 || 15.9.11 || 2017 || 1916 || 191627030 || 14.16
|-
| Visual Studio 2019 version 16.0.0 || 16.0.0 || 2019 || 1920 || 192027508 || 14.20
|-
| Visual Studio 2019 version 16.1.2 || 16.1.2 || 2019 || 1921 || 192127702 || 14.21
|-
| Visual Studio 2019 version 16.2.3 || 16.2.3 || 2019 || 1922 || 192227905 || 14.21
|-
| Visual Studio 2019 version 16.3.2 || 16.3.2 || 2019 || 1923 || 192328105 || 14.21
|-
| Visual Studio 2019 version 16.4.0 || 16.4.0 || 2019 || 1924 || 192428314 || 14.24
|-
| Visual Studio 2019 version 16.5.1 || 16.5.1 || 2019 || 1925 || 192528611 || 14.25
|-
| Visual Studio 2019 version 16.6.2 || 16.6.2 || 2019 || 1926 || 192628806 || 14.26
|-
| Visual Studio 2019 version 16.7 || 16.7 || 2019 || 1927 || 192729112 || 14.27
|-
| Visual Studio 2019 version 16.8.1 || 16.8.1 || 2019 || 1928 || 192829333 || 14.28
|-
| Visual Studio 2019 version 16.8.2 || 16.8.2 || 2019 || 1928 || 192829334 || 14.28
|-
| Visual Studio 2019 version 16.9.2 || 16.9.2 || 2019 || 1928 || 192829913 || 14.28
|-
| Visual Studio 2019 version 16.11.2 || 16.11.2 || 2019 || 1929 || 192930133 || 14.29
|-
| Visual Studio 2019 version 16.11.24 || 16.11.24 || 2019 || 1929 || 192930148 || 14.29
|-
| Visual Studio 2022 version 17.0.1 || 17.0.1 || 2022 || 1930 || 193030705 || 14.30
|-
| Visual Studio 2022 version 17.0.2 || 17.0.2 || 2022 || 1930 || 193030706 || 14.31
|-
| Visual Studio 2022 version 17.2.2 || 17.2.2 || 2022 || 1932 || 193231329 || 14.32
|-
| Visual Studio 2022 version 17.3.4 || 17.3.4 || 2022 || 1933 || 193331630 || 14.33
|-
| Visual Studio 2022 version 17.4.0 || 17.4.0 || 2022 || 1934 || ? || 14.34
|-
| Visual Studio 2022 version 17.5.0 || 17.5.0 || 2022 || 1935 || ? || 14.35
|-
| Visual Studio 2022 version 17.6.0 || 17.6.0 || 2022 || 1936 || ? || 14.36
|-
| Visual Studio 2022 version 17.6.2 || 17.6.2 || 2022 || 1936 || 193632532 || 14.36.32532
|}
The source of this table is.<ref>{{Cite web|title = Pre-defined Compiler Macros / Wiki / Compilers|url = https://dev.to/yumetodo/list-of-mscver-and-mscfullver-8nd|website = dev.to|access-date = 2023-02-20}}</ref>
<ref>{{Cite web|title = Predefined Macros / Microsoft Learn|url=https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170#:~:text=is%20always%20defined.-,_MSC_VER,-Defined%20as%20an|website = learn.microsoft.com|access-date = 2023-05-26}}</ref>
== Compatibility ==
=== ABI ===
The Visual C++ compiler [[Application binary interface|ABI]] have historically changed between major compiler releases.<ref>Microsoft MSDN: [http://msdn.microsoft.com/en-us/library/bb531344.aspx Breaking Changes in Visual C++]</ref> This is especially the case for STL containers, where container sizes have varied a lot between compiler releases.<ref>Microsoft MSDN: [http://msdn.microsoft.com/en-us/library/vstudio/hh438470.aspx Containers (Modern C++)]</ref> Microsoft therefore recommends against using C++ interfaces at module boundaries when one wants to enable client code compiled using a different compiler version. Instead of C++, Microsoft recommends using [[C (programming language)|C]]<ref>Microsoft MSDN: [http://msdn.microsoft.com/en-us/library/vstudio/hh438475.aspx Portability At ABI Boundaries (Modern C++)]</ref> or [[Component Object Model|COM]]<ref>Microsoft forum: [http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/86eda6a7-4d90-4e19-a9d4-6cbe22b661f4 Binary compatibility across Visual C++ versions] {{Webarchive|url=https://archive.today/20130216110824/http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/86eda6a7-4d90-4e19-a9d4-6cbe22b661f4 |date=2013-02-16 }}</ref> interfaces, which are designed to have a stable ABI between compiler releases.
All 14.x MSVC releases have a stable ABI,<ref>docs.microsoft.com: [https://docs.microsoft.com/en-us/cpp/porting/binary-compat-2015-2017? C++ binary compatibility between Visual Studio 2015, 2017, and 2019]</ref> and binaries built with these versions can be mixed in a forwards-compatible manner, noting the following restrictions:
=== C runtime libraries ===
Visual C++ ships with different versions of C runtime libraries.<ref name="MSVCRuntime">[http://msdn.microsoft.com/en-us/library/abx4dbyh.aspx C Run-Time Libraries]</ref> This means users can compile their code with any of the available libraries. However, this can cause some problems when using different components ([[Dynamic-link library|DLLs]], [[EXE]]s) in the same program. A typical example is a program using different [[Library (computing)|libraries]]. The user should use the same [[C standard library|C Run-Time]] for all the program's components unless the implications are understood. Microsoft recommends using the [[Thread (computer science)|multithreaded]], dynamic link library (/MD or /MDd compiler option) to avoid possible problems.<ref name="MSVCRuntime"></ref>
==== POSIX ====
Although Microsoft's CRT implements a large subset of [[POSIX]] interfaces, the Visual C++ compiler will emit a warning on ''every'' use of such functions by default. The rationale is that C and C++ standards require an underscore prefix before implementation-defined interfaces, so the use of these functions are non-standard.<ref>{{cite web |title=Compatibility |url=https://docs.microsoft.com/en-us/cpp/c-runtime-library/compatibility |website=Microsoft: CRT library features |language=en-us}}</ref> However, systems that are actually POSIX-compliant would not accept these underscored names, and it is more portable to just turn off the warning instead.
=== C ===
Although the product originated as an IDE for the [[C (programming language)|C]] programming language, for many years the compiler's support for that language conformed only to the original edition of the [[ANSI C|C standard]], dating from 1989, but not the [[C99]] revision of the standard. There had been no plans to support C99 even in 2011, more than a decade after its publication.<ref>{{cite web|url=https://connect.microsoft.com/VisualStudio/feedback/details/653336/c99-support|title=C99 support|work=Microsoft Connect|archive-url=https://web.archive.org/web/20160304185822/http://connect.microsoft.com/VisualStudio/feedback/details/653336/c99-support|archive-date=2016-03-04|url-status=dead|access-date=2015-09-21}}</ref>
Visual C++ 2013 finally added support for various C99 features in its C mode (including designated initializers, compound literals, and the _Bool type),<ref>{{cite web|title=What's New for Visual C++ in Visual Studio 2013|url=https://msdn.microsoft.com/en-us/library/hh409293(v=vs.120).aspx|work=Microsoft Developer Network|publisher=Microsoft}}</ref> though it was still not complete.<ref>{{cite web|url=http://blogs.msdn.com/b/vcblog/archive/2013/07/19/c99-library-support-in-visual-studio-2013.aspx|title=C99 library support in Visual Studio 2013|author=Pat Brenner|date=July 19, 2013|publisher=Microsoft|work=Visual C++ Team Blog}}</ref> Visual C++ 2015 further improved the C99 support, with full support of the C99 Standard Library, except for features that require C99 language features not yet supported by the compiler.<ref>{{cite web|url=https://msdn.microsoft.com/en-us/library/hh409293(v=vs.140).aspx|title=What's New for Visual C++ in Visual Studio 2015|work=Microsoft Developer Network|publisher=Microsoft}}</ref>
Most of the changes from the [[C11 (C standard revision)|C11]] revision of the standard are still not supported by Visual C++ 2017.<ref>{{cite web|url=https://docs.microsoft.com/en-us/cpp/build/walkthrough-compile-a-c-program-on-the-command-line|title=Walkthrough: Compile a C program on the command line|work=Visual C++ Documentation|publisher=Microsoft}}</ref> For example, generic selections via the _Generic keyword are not supported by the compiler and result in a syntax error.<ref>{{cite web|url=https://developercommunity.visualstudio.com/content/problem/250665/msvc-2017-does-not-support-generic-type-generic-ma.html|title=MSVC 2017 does not support _Generic (type generic macros) in C}}</ref>
The preprocessor was overhauled in 2018, with C11 in sight:<ref>{{cite web|url=https://blogs.msdn.microsoft.com/vcblog/2018/07/06/msvc-preprocessor-progress-towards-conformance/ |title=MSVC Preprocessor Progress towards Conformance |date=July 6, 2018 |last=Luvsanbat |first=Bat-Ulzii |website=[[Microsoft Developer Network]] |archive-url=https://web.archive.org/web/20190108124214/https://blogs.msdn.microsoft.com/vcblog/2018/07/06/msvc-preprocessor-progress-towards-conformance/ |archive-date=8 Jan 2019}}</ref>
{{quote|Full C11 conformance is on our roadmap, and updating the preprocessor is just the first step in that process. The C11 _Generic feature is not actually part of the preprocessor, so it has not yet been implemented. When implemented I expect the feature to work independently of if the traditional or updated preprocessor logic is used.}}
_Generic support has been committed to MSVC as of February 2020, not clear on when it will ship.<ref>{{cite web|url=https://www.reddit.com/r/cpp/comments/hjn4uv/c20_features_and_fixes_in_vs_2019_161_through_166/fwsil0q/?context=3 |title=C++20 Features and Fixes |date=July 3, 2020 |website=[[reddit]]}}</ref>
In September 2020, Microsoft announced C11 and C17 standards support in MSVC.<ref>{{cite web|url=https://devblogs.microsoft.com/cppblog/c11-and-c17-standard-support-arriving-in-msvc/|title=C11 and C17 Standard Support Arriving in MSVC|date=September 14, 2020}}</ref>
=== C++ ===
With default settings MSVC does not do two-phase name lookup which prevents it from flagging a wide range of invalid code. Most checks are deferred to template instantiation. More recent versions remedy this behavior, but it needs to be enabled by the command-line option /permissive-.<ref>{{cite web|url=https://devblogs.microsoft.com/cppblog/two-phase-name-lookup-support-comes-to-msvc/|title=Two-phase name lookup support comes to MSVC|date=2017-09-11}}</ref>
== References ==
{{Reflist|30em}}
== Further reading ==
{{Refbegin}}
== External links ==
{{MS DevTools}}
[[Category:1993 software]]
[[Category:C (programming language) compilers]]
[[Category:C++ compilers]]
[[Category:Integrated development environments]]
[[Category:Microsoft development tools|Visual C++]]
[[Category:Microsoft Visual Studio|C Plus Plus]]