Where are the man pages for C++? [closed]

ぃ、小莉子 提交于 2019-11-26 12:03:33

问题


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.?


回答1:


If you use the "normal" libstdc++ shipped with g++, its documentation is available online here.

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.

This about implementation-specific documentation; 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.com has got much better in the recent years in separating what are the Microsoft-specific details from what the standard dictates.

Finally, if you want precision up to the paranoia, the ultimate normative document is the C++ standard, that is sold from ISO, ANSI and BSI (for a quite high price); there are however several drafts available for free, which are more than good enough for "casual use".




回答2:


In Ubuntu, after installing libstdc++-6-x.x-doc, these docs are available via 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.

==========

Update: as of libstdc++-4.8-doc, the prefix is std:: instead of std_.




回答3:


cppman is a C++ manpage formatter available on Github.

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.




回答4:


Install the man pages:

$ sudo apt-get install libstdc++6-4.4-doc



回答5:


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.




回答6:


On Ubuntu an offline copy of the excellent documentation at http://cppreference.com is available in the packages cppreference-doc-en-html (HTML) and cppreference-doc-en-qch (Qt Help format).

To install:

sudo apt-get install cppreference-doc-en-html



回答7:


On RHEL 6 the package libstdc++-docs installs documentation in /usr/share/doc AND man pages:

sudo yum install -y libstdc++-docs

now I can: man std::string

for example.




回答8:


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.



来源:https://stackoverflow.com/questions/5293737/where-are-the-man-pages-for-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!