2.1. Getting started

You’ll find all what is needed to compile the or-tools library and its third-party libraries in the wiki page Getting Started.

This wiki page is always up to date with the most current instructions on how to install the library, whether from binaries or when compiling the source code. You will also find instructions on how to run the examples.

Pay attention to the fact that this wiki page (and thus the installation procedure) changes regularly and that you might have to reinstall the library and its third-party dependencies from scratch from time to time. If you use the variables defined in our makefiles, and your code doesn’t compile or cannot be linked after an update or reinstallation of the or-tools library, you might have to adapt your own makefiles accordingly.

2.2. Running the tutorial examples

The tutorial examples are the examples provided with this manual. You can find them in documentation/tutorials/cplusplus . For the moment, we only provide a C++ version. For each chapter in this manual (except for the first chapter and the last part of the manual), we provide tutorial examples and a makefile to use them.

2.2.1. C++ examples

2.2.1.1. Compiling and linking

You can compile and link the tutorial examples by invoking:

make tutorials OR_TOOLS_TOP=/directory/to/the/Google/or-tools/directory

where /directory/to/the/Google/or-tools/directory is the absolute or relative directory to the or-tools library. On my disk, this is:

/home/username/.../or-tools-read-only

You can also fill in this variable inside the Makefile.

Instead of compiling (and linking) all tutorial examples at once, you can select a specific example by invoking its target, like so:

  • Windows:

    make cp_is_fun1.exe OR_TOOLS_TOP=/directory/to/the/Google/...
    
  • MacOS and Unix:

    make cp_is_fun1 OR_TOOLS_TOP=/directory/to/the/Google/...
    

where cp_is_fun1 is the target for the example cp_is_fun1.

2.2.1.2. Executing

You can execute C++ examples just by running them:

  • Windows:

    cp_is_fun1
    
  • MacOS and Unix:

    ./cp_is_fun1
    

2.2.1.3. Cleaning

To delete all generated files:

make local_clean

Don’t use

make clean

as you will erase the generated files for the whole library!

Warning

Don’t use make clean to delete the tutorial examples!