Are you sure you're linking against the new 2.0 library? When I do: gsl/doc/examples> gcc -g -Wall -o interp2d interp2d.c -lgsl -lgslcblas -lm
it compiles fine with no problems. On 10/31/2015 04:16 PM, Raymond Rogers wrote: > Same here on Ubuntu 14.04 ; except I had to add "-fpermissive" to > transfer error to warning for: > " > warning: invalid conversion from ‘void*’ to ‘double*’ [-fpermissive] > double *za = malloc(nx * ny * sizeof(double)); > " > I looked in gsl-1.99.90/interpolation > And it seems that the test program uses gsl_interp2d_bilinear in a > different manner; but I haven't tracked it back. > > Here is my output (about the same as yours > g++ solution.cpp -fpermissive -lgslcblas > solution.cpp: In function ‘int main()’: > solution.cpp:17:47: warning: invalid conversion from ‘void*’ to > ‘double*’ [-fpermissive] > double *za = malloc(nx * ny * sizeof(double)); > ^ > /tmp/ccKzCJc1.o: In function `main': > solution.cpp:(.text+0xe): undefined reference to `gsl_interp2d_bilinear' > solution.cpp:(.text+0x7f): undefined reference to `gsl_spline2d_alloc' > solution.cpp:(.text+0x88): undefined reference to > `gsl_interp_accel_alloc' > solution.cpp:(.text+0x91): undefined reference to > `gsl_interp_accel_alloc' > solution.cpp:(.text+0xb3): undefined reference to `gsl_spline2d_set' > solution.cpp:(.text+0xd5): undefined reference to `gsl_spline2d_set' > solution.cpp:(.text+0x105): undefined reference to `gsl_spline2d_set' > solution.cpp:(.text+0x127): undefined reference to `gsl_spline2d_set' > solution.cpp:(.text+0x14b): undefined reference to `gsl_spline2d_init' > solution.cpp:(.text+0x20e): undefined reference to `gsl_spline2d_eval' > solution.cpp:(.text+0x2a5): undefined reference to `gsl_spline2d_free' > solution.cpp:(.text+0x2b1): undefined reference to > `gsl_interp_accel_free' > solution.cpp:(.text+0x2bd): undefined reference to > `gsl_interp_accel_free' > collect2: error: ld returned 1 exit status > > > On 10/29/2015 05:48 PM, Stefano Nicotri wrote: >> Dear bug-gsl, >> >> >> I have tried to compile my C++ source code, which makes use of the >> gsl interp2d library (trying to adapt the example at >> http://www.gnu.org/software/gsl/manual/html_node/2D-Interpolation-Example-programs.html#g_t2D-Interpolation-Example-programs), >> but it seems that some libraries cannot be found: >> >> → g++ solution.cpp -lgsl -lgslcblas >> solution.cpp: In function ‘int main()’: >> solution.cpp:51:2: error: ‘gsl_interp2d_type’ was not declared in >> this scope >> gsl_interp2d_type *T = gsl_interp2d_bilinear; >> ^ >> solution.cpp:51:21: error: ‘T’ was not declared in this scope >> gsl_interp2d_type *T = gsl_interp2d_bilinear; >> ^ >> solution.cpp:51:25: error: ‘gsl_interp2d_bilinear’ was not declared >> in this scope >> gsl_interp2d_type *T = gsl_interp2d_bilinear; >> ^ >> solution.cpp:67:46: error: invalid conversion from ‘void*’ to >> ‘double*’ [-fpermissive] >> double *za = malloc(nr * nt * sizeof(double)); >> ^ >> solution.cpp:68:3: error: ‘gsl_spline2d’ was not declared in this scope >> gsl_spline2d *spline = gsl_spline2d_alloc(T, nr, nt); >> ^ >> solution.cpp:68:17: error: ‘spline’ was not declared in this scope >> gsl_spline2d *spline = gsl_spline2d_alloc(T, nr, nt); >> ^ >> solution.cpp:68:54: error: ‘gsl_spline2d_alloc’ was not declared in >> this scope >> gsl_spline2d *spline = gsl_spline2d_alloc(T, nr, nt); >> ^ >> solution.cpp:100:39: error: ‘gsl_spline2d_set’ was not declared in >> this scope >> gsl_spline2d_set(spline, za, r, t, A); >> ^ >> solution.cpp:106:46: error: ‘gsl_spline2d_init’ was not declared in >> this scope >> gsl_spline2d_init(spline, ra, ta, za, nr, nt); >> ^ >> solution.cpp:109:53: error: ‘gsl_spline2d_eval’ was not declared in >> this scope >> Aval = gsl_spline2d_eval(spline, 2., 2., racc, tacc); >> ^ >> solution.cpp:113:26: error: ‘gsl_spline2d_free’ was not declared in >> this scope >> gsl_spline2d_free(spline); >> ^ >> >> >> >> I have downloaded GSL from this link --> >> http://mirrors.muzzy.it/gnu/gsl/gsl-latest.tar.gz and I have compiled >> it with >> >> ./configure >> make >> sudo make install >> >> >> My OS is Ubuntu 14.04. >> Is it a problem with my system or is some component missing? >> >> Thank you very much, and many apologies for bothering you. >> >> cheers, >> stefano >> >
