Libaries in Visual studio 2017

Armadillo (LAPACK) and Boost


This is a short tutorial on how to install the libraries Armadillo (which include LAPACK and BLAS) and Boost for C++ in Visual Studio 2017. Other libraries may be installed in a similar way, but refer to their respective websites for specific instructions.

Armadillo is a linear algebra library (matrix maths) for the C++ language. In Boost you can find, among many other things, routines to calculate special mathematical functions, such as Bessel functions. Include these libraries only in the projects where you need them.

It is very important to follow the order of these steps, otherwise some of the changes may be reversed.
  • Download the Armadillo and Boost libraries and place the (uncompressed) folders into a convenient location.
  • In Visual Studio open a new project.
  • On the menu bar, choose build, Configuration manager.
  • In the Active solution platform list, choose a 64-bit platform for the solution to target, and then choose the Close button.
  • On the solution explorer (the right-hand side panel) right-click on the project name. Choose Properties.
  • Go to "VC++ directories" and in the field "Include directories" add the full path to armadillo-7.800.2\include (e.g. C:\Users\...\downloads\armadillo-7.800.2\include). Here the entries are separated by ";". Don't delete anything, just add, otherwise you will have to start over again with a new project.
  • Into the field "Library directories" add the full path to armadillo-7.800.2\examples\lib_win64
  • Navigate to "Linker" (on the left) and "Input". In the field "Additional dependences" add blas_win64_MT.lib;lapack_win64_MT.lib
  • Copy all the files in armadillo-7.800.2\examples\lib_win64\ to your project folder, next to the .cpp file.
  • In the file armadillo-7.800.2\include\armadillo_bits\config.hpp uncomment the following lines (some may already be uncommented)
  • #define ARMA_USE_LAPACK
    #define ARMA_USE_BLAS
    #define ARMA_USE_ARPACK
    #define ARMA_USE_SUPERLU
    After this the Armadillo library should be installed successfully. Run a small test program before starting programming.
  • Navigate to "C/C++", "General" and in the field "Additional Include Directories" enter the full path to boost_1_64_0.
  • Navigate to "C/C++", "Precompiled Headers" and in the field "Use Precompiled Header" change its value to "Not using precompiled headers".
  • Check that everything works before you start programming.

To speed up this process you can create a template project: Create an empty project named Template and go through all the previous steps. Now every time you start a new project just copy the project Template, change its name to something more convenient and start working on that. You will not have to go through these steps again.

And to simplify it up even further just use Linux.