Hi all, for people using the GSL library on Windows I suggest using Lhelper with MSYS2
https://github.com/franko/lhelper Lhelper, short for little library helper, is a too I wrote to help developers install third party libraries in isolated environment and with customized build options. The advantage of using Lhelper for GSL are that you can easily compile it as a static library to avoid redistributing DLLs and you can easily choose the option to link with OpenBLAS, the fastest free software library for Blas operations, very close or better than Intel 's MKL. in addition you can choose exactly the CPU you target and enable or not dynamic CPU dispatching for OpenBLAS. The disadvantage of msys's GSL library is that it depends on a lot of DLLs from the msys environment so you if you want to distribute your application you will need to ship a lot of DLLs cherry-picked from msys environment. In addition you don't have any option about how the library is compiled, for example you cannot choose the blas implementation. Lhelper's recipes for GSL, OpenBLAS and other libraries are readily available and others can be added easily. In case you want to try I suggest using the lhelper-2 branch which is ready to be released and improves the workflow. Just make sure you install before a few MSYS2 packages like cmake, ninja, meson and git using pacman and choose the mingw64 version except for git. As a bonus is that lhelper is cross platform and works without modifications on Linux and MacOS as well. Kind regards Francesco Le ven. 3 déc. 2021, 12:55 PM, Vicent Giner Bosch <vigi...@eio.upv.es> a écrit : > Dear all, > > I finally managed to install and use GSL in a Windows environment. In > case it helps anyone else in the future, here are the steps I > followed. > > Please let me know what you think, anyway. > > First of all, despite my question was specifically about Visual Studio > Code, I finally decided to stick with Code::Blocks > (https://www.codeblocks.org/) as an IDE for my programming tasks. Why? > Because I managed to understand how it works and how to set it up. And > because I do not need a programme with many features, but just the > essential ones. > > 1. Install MSYS2 (https://www.msys2.org/) following the instructions > on the same webpage, including the part in which MinGW is installed. > > NOTE: You may need to add `C:\msys64\` to the PATH environment > variable in Windows. > > 2. Install the GSL. The binary files are available as a MSYS2 package > (mingw-w64-x86_64-gsl), so there is no longer need to download/clone > the source files and compile them. HOW TO DO THIS: > 2.1. Open a session of MSYS2. > 2.2. Type `pacman -S mingw-w64-x86_64-gsl` (without the inverted comas). > > 3. Install Code::Blocks > (https://www.codeblocks.org/downloads/binaries/). You may choose the > installation file ended in `-setup.exe`, or the one that ends in > `mingw-setup.exe` which does include MinGW (although we will be using > the MinGW version that was installed together with MSYS2). > > 4. Tell Code::Blocks where the compiler MinGW is located: > 4.1. Go to Settings > Compiler... > Toolchain executables. > 4.2. Type `C:\msys64\mingw64` in Compiler's installation directory > and press OK. > 4.3. Go to Settings > Debugger... > GDB/CDB debugger > Default. > 4.4. Type `C:\msys64\mingw64\bin\gdb.exe` in Executable path and press > OK. > > 5. Tell Code::Blocks where the GSL is located: > 5.1. Go to Settings > Compiler... > Linker settings. > 5.2. Add `C:\msys64\mingw64\lib\libgsl.a` and > `C:\msys64\mingw64\lib\libgslcblas.a`. > > This worked for me, so far. Anyway, I am new to MSYS2 and to using 3rd > party libraries in C, so any critiques of these instructions will be > strongly welcomed. > > I suggest keeping the answers within this thread, so that people > interested in this very same subject can easily find the discussion > and answers in the future. > > Best, > > > -- > vicent > > @vginer_upv > vigibos.webs.upv.es > >