help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] delete function generates an error in movstat.h


From: Montezano, Daniel
Subject: Re: [Help-gsl] delete function generates an error in movstat.h
Date: Wed, 15 Aug 2018 20:59:17 +0000

Hi,

Thanks for the quick reply. It works.
The issue was indeed a conflict of the function name with the C++ keyword.

Thank you so much for your help.
Problem solved!


Daniel

________________________________________
Sent: Wednesday, August 15, 2018 1:40 PM
To: address@hidden;
Subject: Re: [Help-gsl] delete function generates an error in movstat.h

Daniel,

   Sorry for the slow reponse. The problem is that "delete" is a C++
keyword which g++ doesn't like in that header file. I always use gcc to
compile so I didn't see this problem. Please edit your gsl_movstat.h
header file and change "delete" to "delete_sample". Then try compiling
your code.

I will make this update in the git repository also.

Patrick

> Hello there,
>
> Just checking if anyone has come across a similar problem or if anyone has 
> been able to reproduce the error with this code.
>
> On my side, so far no luck. Have reinstalled everything and 
> recompiled/reinstalled GSL and still the issue remains.
>
> Thanks in advance for any help or suggestions.
>
> Daniel
> ________________________________________
> Sent: Thursday, July 26, 2018 10:25 AM
> To: address@hidden
> Subject: Re: [Help-gsl] delete function generates an error in movstat.h
>
> Hi Patrick,
>
> Thanks for the reply.
> The source code I am trying to compile follows below.
>
> The file vector.dat contains the following list of numbers:
> 12, -20, 12, 24, 23, 8, -19, 9, -4, 2, 3, 4, 1, 7, 6, 7, 0, -1, -1, 2, 44, 1, 
> -9, 7, 5, 5, 6, 6, 1, 1
>
> Thanks!
>
> Daniel
>
>
>
> ----------BEGIN SOURCE CODE--------------------------------------
> #include <stdio.h>
> #include <iostream>
> #include <stdlib.h>
>
> #include <gsl/gsl_math.h>
> #include <gsl/gsl_vector.h>
> #include <gsl/gsl_movstat.h>
> #include <gsl/gsl_rng.h>
> #include <gsl/gsl_randist.h>
>
> using namespace std;
> int main(int argc, char** argv) {
>      // window length
>      const size_t K = 13;
>      // time series length
>      const size_t N = 30;
>
>
>      // input time series
>      gsl_vector *x = gsl_vector_alloc (N);
>      {
>          FILE * f = fopen ("vector.dat","r");
>          gsl_vector_fscanf (f,x);
>          fclose (f);
>      }
>
>
>      // output mean time series
>      gsl_vector *xmean = gsl_vector_alloc(N);
>      // workspace for the rolling computation
>      gsl_movstat_workspace * wkspc = gsl_movstat_alloc (K);
>
>
>      // compute the rolling mean for a gsl_vector
>      gsl_movstat_mean (GSL_MOVSTAT_END_PADZERO, x, xmean, wkspc);
>
>      // important to free these things to prevent crashes
>      gsl_vector_free(x);
>      gsl_vector_free(xmean);
>      gsl_movstat_free (wkspc);
>
>      return 0;
> }
> ---------------------- END SOURCE CODE---------------------
>
>
>
> Can you provide your source code?
>
>> Hi,
>>
>> I am trying to compile an example from the docs. Compute a rolling mean using
>> the new package Moving Window Statistics.
>>
>> My code is producing the following error (Windows 10, MinGW.org GCC-6.3.0-1,
>> GSL 2.5):
>>
>>
>>> g++ gsl_rolling_stats.cpp -lgsl -o gsl_rolling_stats.exe
>>>   In file included from gsl_rolling_stats.cpp:11:0:
>>>   c:\documents\progrs\mingw32\include\gsl\gsl_movstat.h:58:9: error: 
>>> expected
>>>   unqualified-id before 'delete'
>>>   int (*delete) (void * vstate);
>>>        ^~~~~~
>>>   c:\documents\progrs\mingw32\include\gsl\gsl_movstat.h:58:9: error: 
>>> expected
>>>   ')' before 'delete'
>> I compiled GSL compiled from source using MinGW and msys. I have tested my
>> GSL installation with other GSL code and everything is working fine.
>>
>> I appreciate any help.
>>
>> Thank you!
>>
>> Daniel
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]