Linux C++ 的手册页在哪里?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5293737/
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
Where are the man pages for C++?
提问by fpointbin
Does documentation for C++ exist in Linux? I want something like the man pages of C. For example, docs for string, stl, iostream, ifstream, etc.?
Linux 中是否存在 C++ 的文档?我想要类似于 C 的手册页的内容。例如,字符串、stl、iostream、ifstream 等的文档?
采纳答案by Matteo Italia
If you use the "normal" libstdc++ shipped with g++, its documentation is available online here.
如果您使用 g++ 附带的“普通”libstdc++,其文档可在此处在线获取。
Most Linux distributions make it also available offline as a particular package; for Debian-derived distros, for example, it's libstdc++-6-<version>-doc
(e.g. on my Ubuntu machine I have libstdc++-6-4.4-doc
installed). In general the documentation will be put somewhere like /usr/share/doc/libstdc++-6-4.4-doc
.
大多数 Linux 发行版也可以将其作为特定包离线使用;例如,对于源自 Debian 的发行版,它是libstdc++-6-<version>-doc
(例如,在我libstdc++-6-4.4-doc
安装的Ubuntu 机器上)。一般来说,文档会放在像/usr/share/doc/libstdc++-6-4.4-doc
.
This about implementation-specificdocumentation; for compiler-agnostic docs, instead, many sites on the Internet provide reference documentation for the standard library. One of the most referenced is cplusplus.com, that however is known to contain several errors in its documentation; also the C++ library section on msdn.microsoft.comhas got much better in the recent years in separating what are the Microsoft-specific details from what the standard dictates.
这是关于特定于实现的文档;对于与编译器无关的文档,Internet 上的许多站点都提供了标准库的参考文档。被引用最多的网站之一是cplusplus.com,但已知其文档中包含几个错误;也msdn.microsoft.com上的C ++库部分中分离是什么从什么标准决定了微软的具体细节已经得到了在最近几年好多了。
Finally, if you want precision up to the paranoia, the ultimate normative document is the C++ standard, that is sold from ISO, ANSIand BSI(for a quite high price); there are however several drafts available for free, which are more than good enough for "casual use".
最后,如果你想要精确到偏执狂,最终的规范文件是C++ 标准,从 ISO、ANSI和BSI出售(价格相当高);然而,有几个免费的草稿,对于“休闲使用”来说已经足够了。
回答by Oswald
The C++ standard library is documented at http://www.cplusplus.com/reference/. Your implementation might bring it's own documentation. For example libstdc++ from the GNU Compiler Collection is documented at http://gcc.gnu.org/onlinedocs/libstdc++/. Look into the source distribution of the specific library to find out if and where the documentation is.
C++ 标准库记录在http://www.cplusplus.com/reference/。您的实现可能会带来它自己的文档。例如,来自 GNU Compiler Collection 的 libstdc++ 记录在http://gcc.gnu.org/onlinedocs/libstdc++/。查看特定库的源代码分发以了解文档是否以及在哪里。
回答by David
You'll want to pay close attention to the version of your compiler; on recent linux distributions you're likely using g++ v4.3, or maybe v4.4, but some of the newer C++0x features are in g++ v4.5, so depending on the features you are playing with, you may run into issues on that front.
您需要密切关注编译器的版本;在最近的 linux 发行版上,您可能使用的是 g++ v4.3 或 v4.4,但一些较新的 C++0x 功能在 g++ v4.5 中,因此根据您正在使用的功能,您可能会运行到这方面的问题。
回答by ukhardy
Install the man pages:
安装手册页:
$ sudo apt-get install libstdc++6-4.4-doc
回答by mic_e
cppman is a C++ manpage formatter available on Github.
cppman 是Github 上提供的 C++ 联机帮助页格式化程序。
On request, it generates manpages from cplusplus.com, and it is quite good at it. Your manpage viewer will be cppman instead of man, though, and you still need to be online.
根据要求,它会从 cplusplus.com 生成联机帮助页,并且非常擅长。但是,您的联机帮助页查看器将是 cppman 而不是 man,并且您仍然需要在线。
回答by lazybug
In Ubuntu, after installing libstdc++-6-x.x-doc
, these docs are available via man
, examples(libstdc++-4.8-doc)
在 Ubuntu 中,安装后libstdc++-6-x.x-doc
,这些文档可通过man
, examples(libstdc++-4.8-doc) 获得
man std::list
man std::weak_ptr
man std::ios_base
To get a list of these entries, use
要获取这些条目的列表,请使用
apropos -r '^std' | vi -
This command gets all man entries beginning with std
and sends them to vi
.
此命令获取所有以 开头的 man 条目std
并将它们发送到vi
.
==========
==========
Update: as of libstdc++-4.8-doc, the prefix is std::
instead of std_
.
更新:从 libstdc++-4.8-doc 开始,前缀std::
代替std_
.
回答by Unacoder
On RHEL 6 the package libstdc++-docs
installs documentation in /usr/share/doc
AND man pages:
在 RHEL 6 上,该软件包libstdc++-docs
在/usr/share/doc
AND 手册页中安装了文档:
sudo yum install -y libstdc++-docs
sudo yum install -y libstdc++-docs
now I can:
man std::string
现在我能:
man std::string
for example.
例如。
回答by zwets
On Ubuntu an offline copy of the excellent documentation at http://cppreference.comis available in the packages cppreference-doc-en-html(HTML) and cppreference-doc-en-qch(Qt Help format).
在Ubuntu的优秀文档的脱机副本http://cppreference.com是在封装cppreference-DOC-EN-HTML(HTML)和cppreference-DOC-EN-QCH(QT帮助格式)。
To install:
安装:
sudo apt-get install cppreference-doc-en-html