C++ Books

Master C++ Programming with Free Open-Source Books

C++ Books

Books are very personal and subjective possessions. And programming books are no exception. But regardless of their style, focus, or pace, good C++ programming books take the reader on a compelling journey, opening eyes to the capabilities of the language, and showing how it can be used to build just about anything.

I have carefully selected C++ books which all share the virtue of being compelling to read. I recommend 9 books which are released under public copyright licenses. Before doing so, I’ll give a brief introduction to C++.

C++ was designed by Bjarne Stroustrup with its first release in 1983. It is a statically typed, free-form, multi-paradigm, portable, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it has a combination of both high-level and low-level language features. C++ was designed for systems and applications programming, extending the C programming language. Hence the name C++, the increment operator is written as ++.

C++ remains a popular programming language. For example, it is heavily used in embedded systems, banking, and telecommunications. It is a superset of C that retains the efficiency and notational convenience of C, while providing facilities for stronger type checking, multiple inheritance, data abstraction, exception handling operator overloading, generic programming, and object-oriented programming. C++ has influenced many other languages including C#, Java, and the development of C.

We have published a series covering the best open source programming books for other popular languages. Read them here.

The Boost C++ Libraries

The Boost C++ Libraries

By Boris Schäling (570 pages)

The Boost C++ libraries are regarded as important and influential in the C++ world. These portable libraries provide support for tasks and structures such as multithreading, containers, string and text processing, iterators, linear algebra, pseudo-random number generation, template metaprogramming, concurrent programming, data structures, image processing, regular expressions, and unit testing. Boost works on almost any modern operating system, including Linux and Windows variants, and supports most modern compilers.

This book introduces 72 Boost libraries that provide a wide range of useful capabilities. They help programmers manage memory and process strings more easily. The libraries provide containers and other data structures that extend the standard library. They make it easy to build platform-independent network applications.

This is a gem to add to any collection. The 430 code examples illustrate the libraries’ capabilities well.

Chapters examine memory management, string handling, containers, data structures, algorithms, communication, streams and files, and time. Later chapters proceed to explore functional, parallel and generic programming. The book closes with masterly coverage on language extensions, error and number handling, application libraries, design patterns, and other libraries.

Boost C++ Libraries is released under the Creative Commons Attribution – NonCommercial – NoDerivatives 4.0 International License. There is a print version to buy on Amazon if you like to carry books around. Electronic version are also available to purchase in Kindle, E-book, and PDF formats.

C++ Annotations

C++ Annotations

By Frank B. Brokken (1029 pages)

The C++ Annotations offers an extensive tutorial about the C++ programming language. It can be used as a textbook for C++ programming courses. The C++ Annotations is intended for knowledgeable users of C or a language that uses a C-like grammar.

Chapters include:

  • Name Spaces
  • Strings – C offers rudimentary string support
  • IO-stream Library – offers an input/output (I/O) library based on class concepts
  • Classes – C offers two methods for structuring data of different types. The C struct holds data members of various types, and the C union also defines data members of various types. This chapter introduces classes, a kind of struct but its contents are by default inaccessible to the outside world
  • Static Data and Functions
  • Memory Management – examines the operators that handle memory allocation in C++
  • Exceptions – allow C++ programs to perform a controlled non-local return, without the disadvantages of longjmp and setjmp
  • Operator Overloading – takes a look at operator overloading in general
  • Abstract Containers
  • Inheritance – another term for derivation. The chapter shows that base class pointers may be used to point to derived class objects
  • Polymorphism – a special form of inheritance
  • Friends – introduces the friend keyword and the principles that underly its use
  • Pointers to Members – defining pointers to members, using pointers to members, pointers to static members, and pointer sizes
  • Nested Classes – used in situations where the nested class has a close conceptual relationship to its surrounding class
  • Standard Template Library (STL) – a general purpose library consisting of containers, generic algorithms, iterators, function objects, allocators, adaptors and data structures. The data structures used by the algorithms are abstract in the sense that the algorithms can be used with (practically) any data type
  • Generic Algorithms – cover the STL’s generic algorithms
  • Function Templates – explores the syntactic peculiarities of templates. The notions of template type parameter, template non-type parameter, and function template are introduced and several examples of templates are provided
  • Class Templates – constructing and using class templates is discussed
  • Advanced Template Use – following a short overview of subtleties related to templates the main characteristics of template meta programming are introduced

The book is available in HTML, PDF, PostScript, and plain text. It’s freely distributable, and published under the terms of the GNU General Public License.

Introduction to Design Patterns in C++ with Qt 4, An

Introduction to Design Patterns in C++ with Qt 4, An

By Alan Ezust, Paul Ezust (656 pages)

This book starts with an introduction to the basic C++ elements, OO concepts, UML, and the core Qt classes. It moves on to higher-level programming ideas, Qt modules, and design patterns. The final part of the book examines important C++ features with rigour. There is good coverage on functions, inheritance and polymorphism.

The book is designed to be used in a university class, and assumes no C or C++ programming experience. It includes Qt examples, exercises, solutions, and lecture slides for instructors.

This book is part of Bruce Perens’ Open Source Series. All books in this series are released under the Open Publication License, v1.0 or later.

How to Think Like a Computer Scientist: C++

How to Think Like a Computer Scientist: C++

By Allen B. Downey (191 pages)

How To Think Like A Computer Scientist C++ version is a concise and gentle introduction to software design using the C++ programming language. Intended for would-be developers with no programming experience, this book starts with the most basic concepts and gradually adds new material at a pace that is comfortable to the reader.

This book providing a wealth of information on:

  • Variables, expressions and statements
  • Functions
  • Conditionals and recursion
  • Fruitful functions
  • Iteration
  • Strings
  • Vectors
  • Member functions
  • Vectors of Objects
  • Objects of Vectors
  • Classes and invariants
  • File Input/Output and apmatrixes

How to Think Like a Computer Scientist: C++ Version is a free textbook available under the Creative Commons Attribution-NonCommercial 3.0 Unported License.

C++ GUI Programming with Qt 3

C++ GUI Programming with Qt 3

By Jasmin Blanchette, Mark Summerfield (464 pages)

The latest stable release of Qt is version 5.8. This book teaches the reader how to write GUI programs using Qt 3, the last version of Qt 3 was released in 2004. But there is a lot of the book which still makes sense for Qt 4 and Qt 5.

C++ GUI Programming with Qt 3 assumes the reader has a rudimentary understanding of C++; this isn’t a book intended for a beginner.

The book introduces the reader to all the concepts and practices to program GUI applications using Qt. Central topics are given a thorough treatment, and there is some specialized and advanced material.

This book is part of Bruce Perens’ Open Source Series. All books in this series are released under the Open Publication License, v1.0 or later.

Open Data Structures (in C++)

Open Data Structures (in C++)

By Pat Morin (336 pages)

This book teaches the design and analysis of basic data structures and their implementation in C++. It covers the implementation and analysis of data structures for sequences (lists), queues, priority queues, unordered dictionaries, ordered dictionaries, and graphs. The author was motivated to offer undergraduate computer science a free way to study data structures. But this book is not intended to act as an introduction to the C++ programming language or the C++ Standard Template library. Instead, it should help programmers understand how STL data structures are implemented and why these implementations are efficient.

Chapters cover array-based lists, linked lists, skiplists, hash tables, binary trees including random binary search trees, scapegoat trees, and red-black trees. Later chapters examine heaps, sorting algorithms (comparison-based, counting sort, and radix sort), graphs, data structures for integers, and external memory searching.

The book and is released under a Creative Commons Attribution License. Read the book for free – released in HTML, PDF, and the book’s LaTeX, Java/C++/Python sources can be downloaded from GitHub. There is also a paperback version to buy. The book has been translated into Slovenian and Turkish.

Cross-Platform GUI Programming with wxWidgets

Cross-Platform GUI Programming with wxWidgets

By Julian Smart and Kevin Hock with Stefan CsomorBrifll (744 pages)

wxWidgets is a popular C++ library that lets developers create applications for Windows, Mac OS X, Linux and other platforms with a single code base. It supports a wide range of graphical libraries.

Following a brief introduction and getting started, the book’s chapters cover:

  • Event handling
  • Window basics
  • Drawing and painting
  • Handing input
  • Window layout using sizers
  • Using standard dialogs
  • Creating custom dialogs
  • Programming with images
  • Clipboard and drag and drop
  • Advanced window classes
  • Data structure classes
  • Files and streams
  • Memory management, debugging and error checking
  • Writing international applications
  • Writing multithreaded applications
  • Programming with wxSocket
  • Working with documents and views
  • Perfecting your application

This book is part of Bruce Perens’ Open Source Series. All books in this series are released under the Open Publication License, v1.0 or later.

The Rook's Guide to C++

The Rook’s Guide to C++

By Jeremy Hansen (160 pages)

Chapters cover variables, literals and constants, output, input, data types and conversion, conditionals (if, else and else if, switch statements), strings, loops, arrays, blocks, functions and scope. Later chapters examine problem solving and troubleshooting, the preprocessor, advanced arithmetic, file I/O, pointers, dynamic data, classes and abstraction, separation compilation and STL.

Most of the book was written during a hackathon weekend by 25 Norwich University students. Certainly not flawless, but a good general text. It is released under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. The book is also available in print from Amazon.

An Introduction to GCC

An Introduction to GCC

By Brian Gough (144 pages)

An Introduction to GCC provides an introduction to the GNU C and C++ Compilers, gcc and g++, which are part of the GNU Compiler Collection (GCC).

This book explains how to use the compiler itself. Based on years of observation of questions posted on mailing lists, it guides the reader straight to the important options of GCC.

Chapters:

  • Introduction
  • Compiling a C program – describes how to compile C programs using gcc. Programs can be compiled from a single source file or from multiple source files, and may use system libraries and header files
  • Compilation options – describes other commonly-used compiler options available in GCC. These options control features such as the search paths used for locating libraries and include files, the use of additional warnings and diagnostics, preprocessor macros and C language dialects
  • Using the preprocessor – describes the use of the GNU C preprocessor cpp, which is part of the GCC package. The preprocessor expands macros in source files before they are compiled. It is automatically called whenever GCC processes a C or C++ program
  • Compiling for debugging – provides the -g debug option to store additional debugging information in object files and executables. This debugging information allows errors to be traced back from a specific machine instruction to the corresponding line in the original source file
  • Compiling with optimization – GCC is an optimizing compiler. It provides a wide range of options which aim to increase the speed, or reduce the size, of the executable files it generates
  • Compiling a C++ program – describes how to use GCC to compile programs written in C++, and the command-line options specific to that language
  • Platform-specific options – describes some of the options available for common platforms: Intel and AMD x86 options, x86 extensions, x86 64-bit processors, DEC Alpha options, SPARC options, POWER/PowerPC options, Multi-architecture support, and floating-point issues
  • Troubleshooting – GCC provides several help and diagnostic options to help troubleshoot problems with the compilation process
  • Compiler-related tools – describes a number of tools which are useful in combination with GCC. These include the GNU archiver ar, for creating libraries, and the GNU profiling and coverage testing programs, gprof and gcov
  • How the compiler works – describes in more detail how GCC transforms source files to an executable file. Compilation is a multi-stage process involving several tools, including the GNU Compiler itself (through the gcc or g++ frontends), the GNU Assembler as, and the GNU Linker ld. The complete set of tools used in the compilation process is referred to as a toolchain
  • Examining compiled files – describes several useful tools for examining the contents of executable files and object files
  • Common error messages – describes the most frequent error and warning messages produced by gcc and g++. Each case is accompanied by a description of the causes, an example and suggestions of possible solutions
  • Getting help – if readers encounters a problem not covered by this introduction, there are several reference manuals which describe GCC and language-related topics in more detail

This book is published under the GNU Free Documentation License.

Click to rate this software
[Total: 0 Average: 0]

Pages: 1 2

7 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.