C和C++中的标准头文件列表

Vij*_*jay 41 c c++ header-files

我在哪里可以找到C和C++中所有头文件的列表?

当我正在构建一个库时,我收到的错误就像' tree.h not found'.我想这是C和C++中的标准头文件.这让我了解了所有头文件及其贡献的好奇心.

我有搜索的地方吗?

我正在使用Solaris Unix.

Jon*_*ler 114

标题'tree.h'在任何地方都不是标准的.


C标准

ISO/IEC 9899:1990(C89,C90)

C89中的15个标准头是:

<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>
Run Code Online (Sandbox Code Playgroud)

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

C94 *(修订1)中引入的3个额外标题是:

<iso646.h>  <wchar.h>  <wctype.h>
Run Code Online (Sandbox Code Playgroud)

ISO/IEC 9899:1999(C99)

C99中的6个额外标题是:

<complex.h>  <inttypes.h>  <stdint.h>  <tgmath.h>
<fenv.h>     <stdbool.h>
Run Code Online (Sandbox Code Playgroud)

ISO/IEC 9899:2011(C11)

C2011中的5个额外标题(总共29个)是:

<stdalign.h>  <stdatomic.h>  <stdnoreturn.h>  <threads.h>  <uchar.h>
Run Code Online (Sandbox Code Playgroud)

ISO/IEC 9045:2008(POSIX 2008,单Unix规范)

请注意,POSIX需要更多标头(82,包括所有C99标头).下面的列表重复标准的C(C99)标题.当然,Windows需要一组不同的标题.

<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>
Run Code Online (Sandbox Code Playgroud)

另请注意,X/Open Curses需要另一组标头.2009年11月发布了该规范的新版本(第7版)(自1996年以来的第一次更新 - 主要区别在于对termcap和预标准C <varargs.h>头的官方支持的丢失).

<curses.h>  <term.h>  <uncntrl.h>
Run Code Online (Sandbox Code Playgroud)

Linux标准库

您可能需要使用其他标头.例如,<getopt.h>在这些列表中没有提及,但如果您使用的是GNU Getopt(例如,对于长选项),则需要使用该标头.根据LSB,Linux Standards Base,它是Linux的标准配置.较旧版本的LSB被定义为ISO/IEC 23360:2006的多个部分; 截至2014-09-21,LSB的当前版本为4.1,但5.0版本处于测试阶段.该文档的一部分定义了包含哪些标题,但在我看到的版本中没有方便的标题表.它与POSIX紧密结合,但具有超出POSIX定义的额外设施.


C++标准

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

该标准列出了特定于C++的32个标头:

<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>
Run Code Online (Sandbox Code Playgroud)

还有18个标题对应于C的标题(对应于C94):

<cassert>  <ciso646>  <csetjmp>  <cstdio>   <ctime>
<cctype>   <climits>  <csignal>  <cstdlib>  <cwchar>
<cerrno>   <clocale>  <cstdarg>  <cstring>  <cwctype>
<cfloat>   <cmath>    <cstddef>
Run Code Online (Sandbox Code Playgroud)

有趣的是,附件D(§D.7)列出了一个不赞成的标题<strstream>,这在标准的前面没有提到.在GCC(g++)7.2.0中包含该标题会生成警告:

/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]
Run Code Online (Sandbox Code Playgroud)

标头<strstream>明确列在标准的其他版本中.

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

C++ 11中的53个C++头文件是:

<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>
Run Code Online (Sandbox Code Playgroud)

与C(C11)相关的26个标题是:

<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>
Run Code Online (Sandbox Code Playgroud)

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

基于ISO/IEC JTC1/SC22/WG21网站上的草案标准N3797的临时标题列表.该数据是从表14和15在部分17.6.1.2 集管,修正如下所述.由于该标准尚未公布(截至2014-09-21),此列表尚未确定.

C++ 14中的54个C++头文件是:

<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>
Run Code Online (Sandbox Code Playgroud)

与C++ 11相比,与C(C11)相关的26个标题保持不变:

<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>
Run Code Online (Sandbox Code Playgroud)

与C++ 11相比,C++ 14列出了一个新的标题,即<shared_mutex>.

注:该草案列出了一些标题(的<deque>,<istream>,<stdexcept>,<unordered_set>两次).另外,从C++ 11 5头在草案的表中未列出,即<exception>,<iterator>,<ratio>,<scoped_allocator>,和<thread>.由于§18.8定义<exception>,§24定义,<iterator>§20.11定义<ratio>,§30定义<thread>,§30.4定义<shared_mutex>,这是一个为什么你不应该相信草案标准作为最后一个词的例子 - 它们包含错误.

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

基于2017年3月21日的N4659草案,C++ 17中的标题暂定列表.这是第20.5.1.2节标题中表16和17的转录.这不是最终标准; 从理论上讲,有些东西可能会发

共有61个C++标题:

<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>
Run Code Online (Sandbox Code Playgroud)

相比C++ 14的新报头似乎是:<any>,<execution>,<filesystem>,<memory_resource>,<optional>,<string_view>,<variant>.

同样,与C++(C11)相关的26个标题与C++ 11和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>
Run Code Online (Sandbox Code Playgroud)

另请参见C++ 17中的新功能有哪些?

请注意,一些"C库"报头的被弃用在C++ 17,具体地<ccomplex>,<cstdalign>,<cstdbool>,<ctgmath>(而不是<ciso646>).<codecvt>在C++ 17中也不推荐使用C++标头(在C++ 11中添加).


*日期中 的"关闭一年"问题是由于批准后处理标准所需的时间.ANSI于1989年批准了原始C标准; ISO于1990年批准.修正案1于1994年获得批准; 它于1995年发布.


Kor*_*icz 18

试试这里:http://en.cppreference.com/w/

但是,您可能还在引用操作系统的头文件.这些可以在MSDN(Windows)或man命令(POSIX系统)上找到.如果你在另一个操作系统上,或者另一个来源.


Ada*_*wen 8

http://www.cplusplus.com/reference/列出了C头文件的所有标准C++头文件和C++包装器.

tree.h不是标准库的一部分.


Car*_*icz 6

我发现这对C标准库的维基百科条目包含的C头文件和详细信息列出了标准他们的一部分.这为您提供了一个很好的历史视角和一些其他相似的细节.

当然那只是C.在"C++标准库"下可以找到类似的文章.这也引用了一些其他库本身可能不是"标准"的,但如果没有这些库,C++会觉得某些人习惯使用扩展程序"瘫痪"了.