C 和 C++ 中的标准头文件列表
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2027991/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
List of standard header files in C and C++
提问by Vijay
Where could I find the list of all header files in C and C++?
我在哪里可以找到 C 和 C++ 中所有头文件的列表?
While I am building a library, I am getting an error like 'tree.h not found
'.
I suppose this is a standard header file in C and C++. This raised in me the curiosity to know all the header files and their contribution.
在构建库时,我收到类似“ tree.h not found
”的错误。我想这是 C 和 C++ 中的标准头文件。这激发了我对所有头文件及其贡献的好奇心。
Is there a place I can search for?
有可以搜索的地方吗?
I am working on Solaris Unix.
我在 Solaris Unix 上工作。
采纳答案by Kornel Kisielewicz
Try here : http://en.cppreference.com/w/
在这里试试: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.
但是,您也可能会参考操作系统的头文件。这些可以在 MSDN (Windows) 上或通过man
命令(POSIX 系统)找到。或者如果您在另一个操作系统上使用另一个来源。
回答by Jonathan Leffler
The header 'tree.h' is not standard anywhere.
标题“tree.h”在任何地方都不是标准的。
C Standards
C标准
ISO/IEC 9899:1990 (C89, C90)
ISO/IEC 9899:1990 (C89, C90)
The 15 standard headers in C89 are:
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>
ISO/IEC 9899:1990/Amd.1:1995
ISO/IEC 9899:1990/Amd.1:1995
The 3 extra headers introduced in C94*(Amendment 1) are:
C94 *(修订版 1)中引入的 3 个额外标头是:
<iso646.h> <wchar.h> <wctype.h>
ISO/IEC 9899:1999 (C99)
ISO/IEC 9899:1999 (C99)
The 6 extra headers in C99 are:
C99 中的 6 个额外头文件是:
<complex.h> <inttypes.h> <stdint.h> <tgmath.h>
<fenv.h> <stdbool.h>
ISO/IEC 9899:2011 (C11)
ISO/IEC 9899:2011 (C11)
The 5 extra headers in C2011 (for a total of 29) are:
C2011 中的 5 个额外标头(总共 29 个)是:
<stdalign.h> <stdatomic.h> <stdnoreturn.h> <threads.h> <uchar.h>
ISO/IEC 9045:2008 (POSIX 2008, Single Unix Specification)
ISO/IEC 9045:2008(POSIX 2008,单一 Unix 规范)
Note that POSIXrequires 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.
请注意,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>
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).
还要注意,X/Open Curses 需要另一组标题。2009 年 11 月发布了该规范的新版本(第 7 版)(自 1996 年以来的第一次更新——主要区别是失去了对 termcap 和预标准 C<varargs.h>
头文件的官方支持)。
<curses.h> <term.h> <uncntrl.h>
Linux Standards Base
Linux 标准库
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.
您可能需要使用其他标题。例如,<getopt.h>
这些列表中没有提及,但如果您使用 GNU Getopt(例如,对于长选项),您将需要并使用该标头。根据LSB,Linux 标准库,它是Linux 上的标准。旧版本的 LSB 被定义为 ISO/IEC 23360:2006 的多个部分;截至 2014 年 9 月 21 日,LSB 的当前版本为 4.1,但 5.0 版处于测试阶段。文档的一部分定义了包含哪些标题,但在我查看的版本中没有方便的标题表。它与 POSIX 密切相关,但具有超出 POSIX 定义的额外功能。
C++ Standards
C++标准
ISO/IEC 14882:1998 (C++98)
ISO/IEC 14882:1998 (C++98)
The standard lists 32 headers specific to C++:
该标准列出了 32 个特定于 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):
还有18个headers对应来自C的headers(对应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:
有趣的是,附件 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]
The header <strstream>
is explicitly listed in the other versions of the standard.
标头<strstream>
在标准的其他版本中明确列出。
ISO/IEC 14882:2011 (C++11)
ISO/IEC 14882:2011 (C++11)
The 53 C++ headers in C++11 are:
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>
The 26 headers related to C (C11) are:
与 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>
ISO/IEC 14882:2014 (C++14)
ISO/IEC 14882:2014 (C++14)
Provisional list of headers based on draft standard N3797 found at ISO/IEC JTC1/SC22/WG21site. 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.
基于在ISO/IEC JTC1/SC22/WG21站点上找到的标准草案 N3797 的头临时列表。数据来自第 17.6.1.2 节标题中的表 14 和 15 ,修改如下。由于该标准尚未发布(截至 2014 年 9 月 21 日),因此该列表尚未确定。
The 54 C++ headers in C++14 are:
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>
The 26 headers related to C (C11) are unchanged compared with C++11:
与 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>
There is one new header listed for C++14 compared to C++11, namely <shared_mutex>
.
与 C++11 相比,C++14 列出了一个新的头文件,即<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.
注意:草案列出了许多标题(<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)
ISO/IEC 14882:2017 (C++17)
Provisional list of headers in C++17 based on the draft N4659dated 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.
基于日期为2017年 3 月21 日的N4659草案的 C++17 头文件的临时列表。这是来自第 20.5.1.2 节标题的表 16 和 17 的转录。这不是最终标准;从理论上讲,有些事情可能会改变。
There are 61 C++ headers:
有 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>
The new headers compared to C++14 seem to be: <any>
, <execution>
, <filesystem>
, <memory_resource>
, <optional>
, <string_view>
, <variant>
.
与 C++14 相比的新头文件似乎是:<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:
同样,与 C++11 和 C++14 相比,与 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>
See also What are the new features in C++17?
另请参阅C++17 中有哪些新功能?
Note that some of the 'C library' headers are deprecatedin C++17, specifically <ccomplex>
, <cstdalign>
, <cstdbool>
, <ctgmath>
(and not <ciso646>
). The C++ header <codecvt>
(added in C++11) is also deprecated in C++17.
请注意,某些“C 库”标头在 C++17中已弃用,特别是<ccomplex>
, <cstdalign>
, <cstdbool>
, <ctgmath>
(而不是<ciso646>
)。C++ 头文件<codecvt>
(在 C++11 中添加)也在 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.
* 日期中的“关闭一年”问题是由于标准获得批准后需要处理的时间。ANSI 于1989 年批准了原始 C 标准;ISO 于 1990 年批准。修订 1 于 1994 年获得批准;它于1995年发布。
回答by Adam Bowen
http://www.cplusplus.com/reference/lists all the standard C++ headers and the C++ wrappers of C header files.
http://www.cplusplus.com/reference/列出了所有标准 C++ 头文件和 C 头文件的 C++ 包装器。
tree.h is not part of the standard library.
tree.h 不是标准库的一部分。
回答by Carl Smotricz
I found this Wikipedia entry on the C standard librarywhich contains, lists of C header files and detailed information on whichstandard they're part of. That gives you a nice historical perspective and some other, similar details.
我在 C 标准库中找到了这个Wikipedia 条目,其中包含 C 头文件列表以及有关它们属于哪个标准的详细信息。这为您提供了一个很好的历史视角和一些其他类似的细节。
Of course that's just C. There's a similar article to be found under "C++ standard library". That also has references to some other libraries which may not be "standard" per se but without which C++ would feel "crippled" to some people used to working with the extensions.
当然,那只是 C。在“C++ 标准库”下可以找到类似的文章。这也引用了一些其他库,这些库本身可能不是“标准”的,但如果没有这些库,对于一些习惯使用扩展的人来说,C++ 会感到“瘫痪”。