Using GSL with cygwin g++

前端 未结 1 1497
清歌不尽
清歌不尽 2020-12-19 15:43

trying to get the Gnu Scientific Library (gsl) to work in cygwin g++.

Cygwin is installed and updated with all default parameters and includes gsl:runtime, gsl-apps

相关标签:
1条回答
  • 2020-12-19 16:16

    I am new to CygWin & GSL as well, and I after some research, I think the answer lies in the fact that the required libraries are not being linked. There is a clever little tool which comes with GSL called gsl-config. You can use this to get the linking information to the libraries. So in your case, the code:

    
     #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;
     }
    
    can be compiled using g++ bessel.cpp -lm -lgsl -o bessel.out -L/usr/bin where the -lm -lgsl -L/usr/bin bit is the output of typing gsl-config --lib-without-cblas. Test using ./bessel.out.

    Hope this helps, T

    0 讨论(0)
提交回复
热议问题