1
votes

I want to use GSL on Windows 10. After I install GSL packages in cygwin, I cannot find the install gsl folder under cygwin. The error is like this:

$ g++ bessel.cpp -lm -lgsl -o bessel.out -L/usr/bin bessel.cpp:1:32: fatal error: gsl/gsl_sf_bessel.h: No such file or directory compilation terminated.

though I do see the GSL packages installed:

enter image description here

I've followed below link on a small test .cpp file. Using GSL with cygwin g++

Please help me on gsl library setup in Windows 10.

Thanks,

2

2 Answers

1
votes

To know where the files are and if the package are installed.
Check wich package contains "gsl" in the name

$ cygcheck -cd |grep gsl
gsl                                     2.3-2
gsl-apps                                2.3-2
gsl-devel                               2.3-2
gsl-doc                                 2.3-2
libgsl-devel                            2.3-2
libgsl0                                 1.16-2
libgsl19                                2.3-2

The headers and import libraries for compilation are in devel packages.
We check the package status:

$ cygcheck -c libgsl-devel
Cygwin Package Information
Package              Version        Status
libgsl-devel         2.3-2          OK

So the package is correclti installed and no files are missing. List the package contents

$ cygcheck -l libgsl-devel
/usr/bin/gsl-config
/usr/include/gsl/gsl_blas.h
/usr/include/gsl/gsl_blas_types.h
/usr/include/gsl/gsl_block.h
/usr/include/gsl/gsl_block_char.h
/usr/include/gsl/gsl_block_complex_double.h
/usr/include/gsl/gsl_block_complex_float.h
/usr/include/gsl/gsl_block_complex_long_double.h
/usr/include/gsl/gsl_block_double.h
/usr/include/gsl/gsl_block_float.h
/usr/include/gsl/gsl_block_int.h
[cut]
/usr/include/gsl/gsl_wavelet2d.h
/usr/lib/libgsl.dll.a
/usr/lib/libgslcblas.dll.a
/usr/lib/pkgconfig/gsl.pc
/usr/share/aclocal/gsl.m4
/usr/share/info/gsl-ref.info-1.gz
/usr/share/info/gsl-ref.info-2.gz
/usr/share/info/gsl-ref.info-3.gz
/usr/share/info/gsl-ref.info-4.gz
/usr/share/info/gsl-ref.info-5.gz
/usr/share/info/gsl-ref.info-6.gz
/usr/share/info/gsl-ref.info.gz
/usr/share/man/man1/gsl-config.1.gz
/usr/share/man/man3/gsl.3.gz
0
votes

If the installation directory for Cygwin is C:\cygwin64, then the header file you reference above is located at the following location:

C:\cygwin64\usr\include\gsl\gsl_sf_bessel.h

If you do not see it there, you may need to reinstall the gsl and libgsl-devel packages from your Cygwin installation program. The code provided on the Using GSL with cygwin g++ page should compile fine as long as you add the stdio.h header file to the source code, as shown in the answer on that page:

#include <gsl/gsl_sf_bessel.h>
#include <stdio.h>

int main (void)
{
    double x = 5.0;
    double y = gsl_sf_bessel_J0 (x);
    printf ("J0(%g) = %.18e\n", x, y);
    return 0;
}

Assuming this file is bessel.cpp, it should compile with:

g++ bessel.cpp -lgsl