Howto get the GNU Scientific Library working with Dev-C++ in Microsoft Windows

This howto provides steps for installing the GNU Scientific Library on Microsoft Windows so that it can be recognized by the Dev-C++  IDE. Then, programs calling functions from gsl can be compiled and run from dev-cpp. This gives you a user friendly environment for numerical/scientific computing in windows. In order to achieve this, you will require the following tools:

The  Dev-C++ IDE for windows: 
This is a free and open source integrated development environment for C/C++ programs designed for windows operating systems (XP, Vista and Windows 7). It comes with the GNU C/C++ compilers bundled together with MinGW, the minimalistic GNU environment for windows.

The MinGW-compiled GNU Scientific (gsl) Library:

A Dev-C++ Project file customized to run GSL programs: 
A dev-cpp project file is a file that can be loaded by the dev-cpp IDE. A project file contains all the information that the IDE needs to understand your software project, such as the source files, any compilation makefiles (or how to build one), libraries to which the executable must be linked, headers whose paths need to be included while compiling the object files, and so on. In our case, you will need a project file that points to the location of the gsl library in your computer, as well as locations to the development headers, and compiler options required by the gsl library. It can be downloaded from dropbox by clicking here and unzipping the archive.

The steps for accomplishing the above are:
Install Dev-cpp from here .

Build or install the latest MinGW binaries for the GNU Scientific Library. Your choices are to either compile them yourself or use mine. The binaries I have built    were compiled on a Windows 7 installation and are 32 bit binaries. They have also been tested on Windows Vista.
  • If you wish to use mine, then download the zip file from here (or from here via dropbox), click on it to open the
    uncompression dialog, and extract the "GSL-1.15" folder in the zip archive  to the "C:\" folder. However, please read this first.
  • Alternatively, you can compile them yourself (recommended). The steps are
  1. Set up the full MinGW suite by downloading the mingw installer named "mingw-get-inst" and using it to install "M-SYS", "MinGW Developer Toolkit" and the "GCC-C" compiler at the very least. Other packages are optional. For details on how to do this, consult the MinGW website.
  2. Once this has been achieved, download the source code for the latest version of the GNU Scientific Library. This can be obtained from their website, or by clicking here.
  3. Copy the downloaded gsl source package to "C:\mingw\msys\1.0\home\"<your user name>.
  4. Create a folder named  GSL-<the version number of your gsl source package> in the directory "C:\".
  5. Open the MinGW shell by following "Start Menu => Programs => Mingw => MinGW Shell"
  6. Once the MinGW shell is open, the shell should drop you to the same home folder where you copied the gsl source package. To test this, type "ls" followed by the enter key and see if the list of files includes the gsl source package.
  7. Now, run the following commands inside the MinGW shell in sequential order. Note that the "make" and "make install" commands can take a long time and show complex output. Unless you see an "error" or "***" anywhere in the output, ignore it.
tar zxvf <the name of your gsl source package>
cd gsl-<the version number of your gsl source package>
./configure --enable-static=yes --enable-shared=yes --prefix=/c/GSL-<version number of gsl source package>
make install

Download this from dropbox and use it for all gsl programs after unzipping it. Load the file into dev-cpp, either by clicking on it, or by using "load project file" from the dev-cpp project menu. A sample file ("main.c") is included. If you wish to change to a version ater than 1.15. Simply open the file in notepad or whatever and change all occurrences of "GSL_1.15" to "GSL-"<the version number of your gsl source package>.


  1. Note that the file assumes that you are placing the file and the associated "main.c" in the Desktop. If you place them anywhere else (make sure that it  is at least in the main C-drive, and keep the and main.c in the same folder), update line 14 of the (use any text editor like notepad) to reflect the path of the gsl libraries relative to the present location of as seen by mingw, a program that only understands unix file systems. For example, if you uncompress the and main.c file in "C:\some_directory\some_other_directory\blabla\voodoo\woowoo\", then update line 14 in to:  "Linker=../../../../../GSL-1.15/lib/libgsl.a_@@_../../../../../GSL-1.15/lib/libgslcblas.a_@@_"
  2. A problem when using my precompiled binaries has been reported to me. If there is a gcc compiler version mismatch between the version used to compile the libraries and the version that you're using to compile your code, then errors may arise. The solution is to compile the libraries yourself and use the same gcc version to compile your code. When gcc gets updated to a new version, simply repeat all the above steps after updating your gcc in the mingw shell or wherever.

Valid HTML 4.01 Transitional