Sometimes when I was traveling in the airplane and there is no Internet access, programming, especially programming using C++, became hard for me since there is no documentation for me to look up. So I started to look for C++ documentation that can be used offline.
cppreference.com provides several ways of viewing C++ documentation offline. I tried some of them and noticed that each of them has advantages and drawbacks.
In this blog post, I am going to document what I thought about those methods of viewing C++ documentation offline, and recommend a better way to do in practice.
We could download a HTML book from the archives on cppreference.com. When we browse it using Chrome or Firefox, the format and display would be almost exactly the same to what is on the online website.
The drawback of HTML Book is that we could only use the index provided by the book to look for what we want. Searching the content is not possible.
Devhelp is a documentation browser for GTK/Gnome. We could install Devhelp and the HTML book which Devhelp would load using the following commands.
$ sudo apt-get update $ sudo apt-get install devhelp cppreference-doc-en-html
The HTML book installed via
apt-get would be installed to
/usr/share/cppreference/doc/html/. However, it might not be up-to-date. Although I have not tried it myself, my expectation is that we could replace the entire book to the latest one we could download from the archives on cppreference.com. Simply run the following command to start Devhelp and the C++ HTML book will be in the list.
The rendering and display are actually very close to the HTML book. The drawback is Devhelp is not portable. It is not available in Windows and the Linux distributions which do not use GTK/Gnome. It does not have search engine neither. The “search” is entirely based on index.
Qt Help Book
qch is a documentation format for use in the Qt tools. There is a
qch format C++ reference book we could download from the archives on cppreference.com. We also need to install Qt Assistant to view the C++ Qt help book.
$ sudo apt-get update $ sudo apt-get install qtcreator $ # A minimal installation $ # sudo apt-get install qt5-assistant
After installation, we start Qt Assistant using the following command.
The we load the the C++ Qt help book by clicking
The rendering and display in the Qt Assistant are bad. The advantages of Qt Assistant is that it is available on Windows and different Linux distributions. Qt Assistant also comes with search engine which is very attractive to users.
The following recommended installation method from cppreference.com does not work quite well. It comes with Qt Assistant 4 instead of 5. Some characters could not display correctly somehow. The C++ Qt Help Book it comes with, which is in the
/usr/share/cppreference/doc/qch/, is also out-of-date.
$ sudo apt-get update $ sudo apt-get install cppreference-doc-en-qch
I would recommend to install at least the HTML book for reading and the Qt help book for searching.