Where to get the source code for the C++ standard library?

Viewed 51008

is it possible to get the source code for standard c++ library?

10 Answers

You should already have the sources in your compiler installation. If you are using an IDE with a "jump to include file" command, select any STL header and jump to it. If you are using some kind of UNIX, look in /usr/include/c++. See where that STL header includes other headers and recurse :v) .

If you have Visual Studio Professional, it has source code in

X:\Microsoft Visual Studio 9.0\VC\crt\src

For Win10x64 with VS2017 default install paths,the source code are here:

part1:VCRuntime,which include code that will change for every version of Visual Studio,it contains function like the CRT entry point "mainCRTStartup",the code are here:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\crt\src

part2:C standard library,which include code that is stable over generations of Visual Studio,like the function fopen,and it also contains stable CRT functions like _initterm,the code are here:

C:\Program Files (x86)\Windows Kits\10\Source\10.0.17763.0\ucrt

i.e. this part has been moved to Windows SDK,distributed with Windows instead of Visual Studio.

references:

https://devblogs.microsoft.com/cppblog/introducing-the-universal-crt/

Since today 16th September 2019 the Microsoft MSVC's STL is available on GitHub.

Related