Setting up a development environment

Note: the following instructions assume that you are connected to the Internet and that you are using GCC on a POSIX compatible operating system. All unix shell commands are assumed to be running from your home directory ($HOME). Finally, any command that begins with sudo assums that you have administrative rights on your machine. If you do not — please ask your system administrator about installing the software you need.

Placing doctest.h for easy access

doctest is a C++ testing framework that is light on resources and easy to use, making it an ideal tool for beginners learning C++.

Configuring CPATH for Local Libraries

CPATH is an environment variable that specifies the search path that the preprocessor uses to look for somelibrary.h in a:

#include <somelibrary.h>

directive.

To set our CPATH, we need to:

  1. create a directory where C/C++ libraries will be stored.

  2. set the CPATH environment variable to the path to that directory.

On a Debian GNU/Linux syste this can be accomplished by:

  1. running: $ mkdir -p ~/.local/lib/gcc/include

  2. adding the line:

    export CPATH=$HOME/.local/lib/gcc/include/
    

    to my your .bashrc file (Note: MacOS users will have to add this to .zshrc instead).

After copying doctest.h to ~/.local/lib/gcc/include, you will now be able to simply add:

#include <doctest.h>

to any program in which you want to use doctest.