If you have access to a a highly tuned BLAS version, like the one provided with MKL, I suggest to use it.
Next, install GSL with: 1 sudo apt install libgsl-devīy default GSL will use a GSL built version of BLAS which is a library for basic vector and matrix operations. Open a Terminal and write: 1 sudo apt install build-essential gdb cmake pkg-config Let’s start by installing a C++ toolchain. Now, that you have GSL installed, open your preferred C++ editor (if you don’t have one, a good suggestion is Visual Studio Code) and write a C++ GSL program, see the GSL usage part of the article for an example.įor Linux, I will exemplify the installation part on a Debian based system. Once the Command Line Tools are installed, we need to install the Homebrew package manager which will let us install GSL: 1 /usr/bin/ruby -e "$(curl -fsSL )"Īt this point, you should be able to use the brew command to install GSL and CMake: 1 brew install gsl cmake Just follow the installer suggestions to get the Command Line Tools. Open a Terminal and write: 1 xcode-select -install On macOS, I recommend that you install the Command Line Tools which will give you the Clang C++ compiler and also installs a bunch of useful utilities like make, git, vim and so on.
You can remove the hello world C++ code that is generated by the compiler and write your C++ GSL program, see the GSL usage part of the article for an example. Now, that you have GSL installed, start Visual Studio and create a new C++ console project. If you want to create a CMake project, you will need to add the include folders and libraries to the CMake project.
vcpkg is not added to the system path, so you need to be in the vcpkg folder in order to be able to use it.Īs a side note, a library installed with vcpkg is directly available in your msbuild projects (the ones created by default by Visual Studio). Next time when you want to install a C++ library that is available in the vcpkg ports, remember to open a PowerShell window and navigate to the where you’ve installed vcpkg.
The above command will build and install GSL for 32 and 64 bits Visual Studio projects. Once you use vcpkg to install a library, it will be available in your Visual Studio C++ projects. You can find the complete list of available libraries in the ports folder from the vcpkg installation. \vcpkg integrate installĪt this point, you can use the vcpkg command to install any of the available C++ libraries. Next, we are going to use git to get the latest vcpkg version: 1 git clone Īfter the above command finishes, go to the vcpkg folder, bootstrap and integrate vcpkg: 1 cd vcpkg 2. Open a PowerShell window ( PowerShell is already installed on Windows, you can find it in the Start menu): 1 cd C:\ 2 mkdir DEV 3 cd DEV I will install vcpkg in a folder on my C drive, feel free to install it in a different location, just avoid paths with empty spaces. If you are not familiar with git, just accept the defaults suggested by the installer.įinally, we are going to install vcpkg which is a C++ library manager that will let us install GSL. Once the Visual Studio installer starts, check the Desktop development with C++ workload: Make sure that you install the proper Visual Studio and not Visual Studio Code which is an entirely different product.
I recommend that you read the install part for your OS and the part that shows how to use GSL to solve a linear system of equations.įor Windows, I recommend that you first install Visual Studio 2019.