List of standard header files in C and C++

Try here : http://en.cppreference.com/w/

However, you may also be refering to the header files of your OS. These can be found either on MSDN (Windows) or by man command (POSIX systems). Or another source if you're on another OS.


The header 'tree.h' is not standard anywhere.


C Standards

ISO/IEC 9899:1990 (C89, C90)

The 15 standard headers in C89 are:

<assert.h>  <limits.h>  <signal.h>  <stdlib.h>
<ctype.h>   <locale.h>  <stdarg.h>  <string.h>
<errno.h>   <math.h>    <stddef.h>  <time.h>
<float.h>   <setjmp.h>  <stdio.h>

ISO/IEC 9899:1990/Amd.1:1995

The 3 extra headers introduced in C94* (Amendment 1) are:

<iso646.h>  <wchar.h>  <wctype.h>

ISO/IEC 9899:1999 (C99)

The 6 extra headers in C99 are:

<complex.h>  <inttypes.h>  <stdint.h>  <tgmath.h>
<fenv.h>     <stdbool.h>

ISO/IEC 9899:2011 (C11)

The 5 extra headers in C2011 (for a total of 29) are:

<stdalign.h>  <stdatomic.h>  <stdnoreturn.h>  <threads.h>  <uchar.h>

ISO/IEC 9045:2008 (POSIX 2008, Single Unix Specification)

Note that POSIX requires many more headers (82, including all the C99 headers). The list below repeats the standard C (C99) headers. Windows requires a different set of headers, of course.

<aio.h>        <libgen.h>       <spawn.h>         <sys/time.h>
<arpa/inet.h>  <limits.h>       <stdarg.h>        <sys/times.h>
<assert.h>     <locale.h>       <stdbool.h>       <sys/types.h>
<complex.h>    <math.h>         <stddef.h>        <sys/uio.h>
<cpio.h>       <monetary.h>     <stdint.h>        <sys/un.h>
<ctype.h>      <mqueue.h>       <stdio.h>         <sys/utsname.h>
<dirent.h>     <ndbm.h>         <stdlib.h>        <sys/wait.h>
<dlfcn.h>      <net/if.h>       <string.h>        <syslog.h>
<errno.h>      <netdb.h>        <strings.h>       <tar.h>
<fcntl.h>      <netinet/in.h>   <stropts.h>       <termios.h>
<fenv.h>       <netinet/tcp.h>  <sys/ipc.h>       <tgmath.h>
<float.h>      <nl_types.h>     <sys/mman.h>      <time.h>
<fmtmsg.h>     <poll.h>         <sys/msg.h>       <trace.h>
<fnmatch.h>    <pthread.h>      <sys/resource.h>  <ulimit.h>
<ftw.h>        <pwd.h>          <sys/select.h>    <unistd.h>
<glob.h>       <regex.h>        <sys/sem.h>       <utime.h>
<grp.h>        <sched.h>        <sys/shm.h>       <utmpx.h>
<iconv.h>      <search.h>       <sys/socket.h>    <wchar.h>
<inttypes.h>   <semaphore.h>    <sys/stat.h>      <wctype.h>
<iso646.h>     <setjmp.h>       <sys/statvfs.h>   <wordexp.h>
<langinfo.h>   <signal.h>

Note, too, that X/Open Curses requires another set of headers. There was a new version (Release 7) of that specification released in November 2009 (the first update since 1996 — the primary differences are the loss of official support for termcap and pre-standard C <varargs.h> header).

<curses.h>  <term.h>  <uncntrl.h>

Linux Standards Base

There are other headers that you might need to use. For example, there is no mention of <getopt.h> in these lists, but if you are using GNU Getopt (for long options, for example), you will need and use that header. It is standard on Linux according to the LSB, Linux Standards Base. An older version of the LSB was defined as ISO/IEC 23360:2006 in multiple parts; as of 2014-09-21, the current version of the LSB is 4.1 but version 5.0 is in beta. There is a section of the document that defines which headers are included, but there is no convenient table of the headers in the version I looked at. It is closely aligned with POSIX, but has extra facilities beyond what POSIX defines.


C++ Standards

ISO/IEC 14882:1998 (C++98)

The standard lists 32 headers specific to C++:

<algorithm>   <iomanip>   <list>     <ostream>    <streambuf>
<bitset>      <ios>       <locale>   <queue>      <string>
<complex>     <iosfwd>    <map>      <set>        <typeinfo>
<deque>       <iostream>  <memory>   <sstream>    <utility>
<exception>   <istream>   <new>      <stack>      <valarray>
<fstream>     <iterator>  <numeric>  <stdexcept>  <vector>
<functional>  <limits>

There are also 18 headers corresponding to headers from C (corresponding to C94):

<cassert>  <ciso646>  <csetjmp>  <cstdio>   <ctime>
<cctype>   <climits>  <csignal>  <cstdlib>  <cwchar>
<cerrno>   <clocale>  <cstdarg>  <cstring>  <cwctype>
<cfloat>   <cmath>    <cstddef>

Intriguingly, Annex D (§D.7) lists a deprecated header, <strstream>, that is not mentioned earlier in the standard. Including that header with GCC (g++) 7.2.0 generates a warning:

/opt/gcc/v7.2.0/include/c++/7.2.0/backward/backward_warning.h:32:2:
warning: #warning This file includes at least one deprecated or antiquated
header which may be removed without further notice at a future date.
Please use a non-deprecated interface with equivalent functionality
instead. For a listing of replacement headers and interfaces, consult
the file backward_warning.h. To disable this warning use -Wno-deprecated. [-Wcpp]

The header <strstream> is explicitly listed in the other versions of the standard.

ISO/IEC 14882:2011 (C++11)

The 53 C++ headers in C++11 are:

<algorithm>           <initializer_list>  <numeric>           <system_error>
<array>               <iomanip>           <ostream>           <thread>
<atomic>              <ios>               <queue>             <tuple>
<bitset>              <iosfwd>            <random>            <type_traits>
<chrono>              <iostream>          <ratio>             <typeindex>
<codecvt>             <istream>           <regex>             <typeinfo>
<complex>             <iterator>          <scoped_allocator>  <unordered_map>
<condition_variable>  <limits>            <set>               <unordered_set>
<deque>               <list>              <sstream>           <utility>
<exception>           <locale>            <stack>             <valarray>
<forward_list>        <map>               <stdexcept>         <vector>
<fstream>             <memory>            <streambuf>
<functional>          <mutex>             <string>
<future>              <new>               <strstream>

The 26 headers related to C (C11) are:

<cassert>   <cinttypes>  <csignal>    <cstdio>   <cwchar>
<ccomplex>  <ciso646>    <cstdalign>  <cstdlib>  <cwctype>
<cctype>    <climits>    <cstdarg>    <cstring>
<cerrno>    <clocale>    <cstdbool>   <ctgmath>
<cfenv>     <cmath>      <cstddef>    <ctime>
<cfloat>    <csetjmp>    <cstdint>    <cuchar>

ISO/IEC 14882:2014 (C++14)

Provisional list of headers based on draft standard N3797 found at ISO/IEC JTC1/SC22/WG21 site. The data is from tables 14 and 15 in section 17.6.1.2 Headers, amended as noted below. Since the standard has not been published (as of 2014-09-21), this list is not yet definitive.

The 54 C++ headers in C++14 are:

<algorithm>           <initializer_list>  <numeric>           <strstream>
<array>               <iomanip>           <ostream>           <system_error>
<atomic>              <ios>               <queue>             <thread>
<bitset>              <iosfwd>            <random>            <tuple>
<chrono>              <iostream>          <ratio>             <type_traits>
<codecvt>             <istream>           <regex>             <typeindex>
<complex>             <iterator>          <scoped_allocator>  <typeinfo>
<condition_variable>  <limits>            <set>               <unordered_map>
<deque>               <list>              <shared_mutex>      <unordered_set>
<exception>           <locale>            <sstream>           <utility>
<forward_list>        <map>               <stack>             <valarray>
<fstream>             <memory>            <stdexcept>         <vector>
<functional>          <mutex>             <streambuf>
<future>              <new>               <string>

The 26 headers related to C (C11) are unchanged compared with C++11:

<cassert>   <cinttypes>  <csignal>    <cstdio>   <cwchar>
<ccomplex>  <ciso646>    <cstdalign>  <cstdlib>  <cwctype>
<cctype>    <climits>    <cstdarg>    <cstring>
<cerrno>    <clocale>    <cstdbool>   <ctgmath>
<cfenv>     <cmath>      <cstddef>    <ctime>
<cfloat>    <csetjmp>    <cstdint>    <cuchar>

There is one new header listed for C++14 compared to C++11, namely <shared_mutex>.

NB: The draft lists a number of the headers (<deque>, <istream>, <stdexcept>, <unordered_set>) twice. Also, 5 headers from C++11 are not listed in the tables in the draft, namely <exception>, <iterator>, <ratio>, <scoped_allocator>, and <thread>. Since §18.8 defines <exception>, §24 defines <iterator>, §20.11 defines <ratio>, §30 defines <thread>, and §30.4 defines <shared_mutex>, this is an example of why you should not trust the draft standards as being the final word — they contain errors.

ISO/IEC 14882:2017 (C++17)

Provisional list of headers in C++17 based on the draft N4659 dated 2017-03-21. This is a transcription of tables 16 and 17 from section 20.5.1.2 Headers. This is not the final standard; in theory, something could change.

There are 61 C++ headers:

<algorithm>           <future>            <numeric>           <strstream>
<any>                 <initializer_list>  <optional>          <system_error>
<array>               <iomanip>           <ostream>           <thread>
<atomic>              <ios>               <queue>             <tuple>
<bitset>              <iosfwd>            <random>            <type_traits>
<chrono>              <iostream>          <ratio>             <typeindex>
<codecvt>             <istream>           <regex>             <typeinfo>
<complex>             <iterator>          <scoped_allocator>  <unordered_map>
<condition_variable>  <limits>            <set>               <unordered_set>
<deque>               <list>              <shared_mutex>      <utility>
<exception>           <locale>            <sstream>           <valarray>
<execution>           <map>               <stack>             <variant>
<filesystem>          <memory>            <stdexcept>         <vector>
<forward_list>        <memory_resource>   <streambuf>
<fstream>             <mutex>             <string>
<functional>          <new>               <string_view>

The new headers compared to C++14 seem to be: <any>, <execution>, <filesystem>, <memory_resource>, <optional>, <string_view>, <variant>.

Again, the 26 headers related to C (C11) are unchanged compared with C++11 and C++14:

<cassert>   <cinttypes>  <csignal>    <cstdio>   <cwchar>
<ccomplex>  <ciso646>    <cstdalign>  <cstdlib>  <cwctype>
<cctype>    <climits>    <cstdarg>    <cstring>
<cerrno>    <clocale>    <cstdbool>   <ctgmath>
<cfenv>     <cmath>      <cstddef>    <ctime>
<cfloat>    <csetjmp>    <cstdint>    <cuchar>

See also What are the new features in C++17?

Note that some of the 'C library' headers are deprecated in C++17, specifically <ccomplex>, <cstdalign>, <cstdbool>, <ctgmath> (and not <ciso646>). The C++ header <codecvt> (added in C++11) is also deprecated in C++17.


*The 'off by one year' issues in the dates are due to the time it takes to process the standard after it is approved. ANSI approved the original C standard in 1989; ISO approved it in 1990. Amendment 1 was approved in 1994; it was released in 1995.