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.?
-
6Are you looking for a resource *not* on the internet? – Greg Hewgill Mar 14 '11 at 01:10
-
1You can just search up "c++
" Most of the time this will result in a page from cplusplus.com – flight Mar 14 '11 at 01:11 -
1If only he had asked a more specific question, we could have pointed him to lmgtfy... – Don Branson Mar 14 '11 at 01:16
-
16Just yesterday I found myself wishing libstdc++ provided manpages rather than forcing me to use a web browser to find documentation. – sarnold Mar 14 '11 at 01:42
-
1@Don Branson, thanks! but, i can see many people that could answer perfectly... – fpointbin Mar 14 '11 at 01:43
-
1To the commenters above, have you ever done development somewhere that you had difficult or impossible access to the internet? Imagine that your only access is 25 to 75 steps away, on a machine shared by other people that use it throughout the day. And this is the only place that you can access the internet. No wifi or cell phone is available. And no modifications to the network are possible. – Pulseczar Aug 14 '17 at 20:40
-
10For other readers, you can clone this [repo](https://github.com/jeaye/stdman) then `./configure` and `make install` on your system. It will install documentation from cppreference.com available via your `man` command ie. `man std::queue`. Quite handy. – haxpor Jul 05 '18 at 15:59
8 Answers
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 nowadays cppreference.com, that is actively maintained, tends to be very faithful to the standard and shows well the differences between the various standard versions; it can be a bit intimidating to newbies, though.
cplusplus.com historically was one of the most used (especially as it is very "liked" by search engines), but was known to contain several errors or incorrect simplifications; I don't know if it got any better in these last years.
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".

- 123,740
- 17
- 206
- 299
-
1Thank you! It was a perfect answer to my doubt... I was searching it for a long time, but i couldnt find any answer like this... – fpointbin Mar 14 '11 at 01:49
-
24IMO the best compiler-agnostic reference is http://en.cppreference.com/w/ it is mostly accurate, and it shows whether any given feature is C++03 or C++11 – Fabio Fracassi Aug 07 '12 at 11:00
-
7@FabioFracassi Yes, and in november 2014 the offline version of the documentation at cppreference.com was added to Ubuntu Vivid: `apt-get install cppreference-doc-en-html`. – zwets Oct 09 '15 at 07:05
-
1
-
There's also a set of C++ man pages that can be copied from OpenSolaris, but they're incomplete to say the least. – Throw Away Account Nov 27 '19 at 01:01
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_
.

- 28,822
- 27
- 83
- 158

- 6,033
- 2
- 17
- 15
-
Doesn't appear to work in Ubuntu 12.04. I.e. I installed this package, but your example commands don't give the manual pages. – Ruslan Mar 06 '14 at 07:42
-
1@Ruslan I have updated my answer, the prefix changed to `std::` instead of `std_` – don't panic Mar 06 '14 at 11:23
-
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.

- 19,791
- 12
- 64
- 80

- 5,594
- 4
- 34
- 49
-
3You can now cache all of them for off-line viewing. It takes approx 20 minutes. – Dilawar Apr 16 '13 at 19:29
-
-
1And the command for offline caching, after the [installation1](https://github.com/aitjcize/cppman/wiki/Installing-from-Ubuntu-PPA) or [installation2](https://github.com/aitjcize/cppman#installation) is simply `cppman -c` – Loves Probability Jun 10 '17 at 10:31
Install the man pages:
$ sudo apt-get install libstdc++6-4.4-doc

- 2,084
- 1
- 13
- 12
-
-
6Just for the sake of precision, these are not manpages, but HTML docs (put in `/usr/share/doc/libstdc++4.4-doc`). – Matteo Italia Mar 14 '11 at 01:18
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.

- 31,254
- 3
- 43
- 68
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

- 276
- 3
- 8
-
1
-
2I installed `cppreference-doc-en-html` in Ubuntu, but how should I use it? Doing `man fputs` will open Linux Programmer's Manual and not cppreference documentation. In other words, where are cppreference docs stored? – builder-7000 Apr 08 '18 at 06:43
-
2@Sergio `dpkg -L cppreference-doc-en-html` will tell you the contents of the package. – zwets Apr 09 '18 at 05:29
-
@zwets Thank you! That solved the problem now I can access the documentation. – builder-7000 Apr 09 '18 at 06:31
-
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.

- 71
- 3
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.

- 2,550
- 7
- 27
- 29