[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] "gsl_spmatrix_float_alloc_nzmax" undefined reference
From: |
Patrick Alken |
Subject: |
Re: [Help-gsl] "gsl_spmatrix_float_alloc_nzmax" undefined reference |
Date: |
Mon, 14 Oct 2019 15:06:12 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
Your MWE program compiles and runs ok for me. Did you check if you might
be linking to an old version of GSL with -lgsl? You may have the new gsl
library installed somewhere different.
On 10/14/19 4:48 AM, 2592680259 wrote:
> I was using "g++ test_gsl.cpp -I/usr/local/include -lgsl -lgslcblas -o
> test_gsl.o", but got error message:
>
>
> undefined reference to `gsl_spmatrix_float_alloc_nzmax'
> undefined reference to `gsl_spmatrix_float_d2sp'
>
>
> those two functions are declared in "gsl/gsl_spmatrix_float.h".
>
>
> The MWE for "test_gsl.cpp" is listed below
>
>
> #include <iostream>
> #include <cmath>
> #include <string>
> #include <gsl/gsl_matrix.h>
> #include <gsl/gsl_matrix_float.h>
> #include <gsl/gsl_spmatrix.h>
> #include <gsl/gsl_spmatrix_float.h>
>
>
> using namespace std;
>
>
> const int N = 32 * 40 * 2;
> const int N_nz = 25530;
>
>
> int main(int argc, char **argv)
> {
> gsl_matrix *test = gsl_matrix_alloc(N, N);
> gsl_matrix_float *test_float = gsl_matrix_float_alloc(N, N);
>
>
> gsl_spmatrix *test_sp = gsl_spmatrix_alloc_nzmax(N, N, N_nz,
> GSL_SPMATRIX_COO);
> gsl_spmatrix_d2sp(test_sp, test);
>
>
> gsl_spmatrix_float *test_float_sp = gsl_spmatrix_float_alloc_nzmax(N, N,
> N_nz, GSL_SPMATRIX_COO);
> gsl_spmatrix_float_d2sp(test_float_sp, test_float);
>
>
> gsl_matrix_free(test);
> gsl_matrix_float_free(test_float);
> gsl_spmatrix_free(test_sp);
> gsl_spmatrix_float_free(test_float_sp);
>
>
>
>
> return 0;
> }