AnsweredAssumed Answered

got error for installing new signal source block

Question asked by patil on Jul 11, 2017
Latest reply on Jul 14, 2017 by patil


#ifndef INCLUDED_GR_FXPT_H
#define INCLUDED_GR_FXPT_H

 

#include <test/api.h>
#include <types.h>
#include <stdint.h>
#include <complex>
namespace gr {

   class GR_TEST_API fxpt
  {
    static const int WORDBITS = 32;
    static const int NBITS = 10;
    static const float s_sine_table[1 << NBITS][2];
    static const float PI = 3.14159265359;
    static const float TWO_TO_THE_31 = 2147483648;

 

  public:
    static int32_t
      float_to_fixed(float x)
    {
      // Fold x into -PI to PI.
      int d = (int)floor(x/2/PI+0.5);
      x -= d*2*PI;
      // And convert to an integer.
      return (int32_t) ((float) x * TWO_TO_THE_31 / PI);
    }

 

    static float
      fixed_to_float (int32_t x)
    {
      return x * (PI / TWO_TO_THE_31);
    }

      static float sin(int32_t x)
    {
      uint32_t ux = x;
     static const int WORDBITS = 32;
      int index = ux >> (WORDBITS - NBITS);
      return s_sine_table[index][0] * (ux >> 1) + s_sine_table[index][1];
    }

    static float
      cos (int32_t x)
    {
      uint32_t ux = x + 0x40000000; static const int WORDBITS = 32;
      int index = ux >> (WORDBITS - NBITS);
      return s_sine_table[index][0] * (ux >> 1) + s_sine_table[index][1];
    }
    static void sincos(int32_t x, float *s, float *c)
    {
      uint32_t ux = x; static const int WORDBITS = 32;
      int sin_index = ux >> (WORDBITS - NBITS);
      *s = s_sine_table[sin_index][0] * (ux >> 1) + s_sine_table[sin_index][1];

 

      ux = x + 0x40000000;
      int cos_index = ux >> (WORDBITS - NBITS);
      *c = s_sine_table[cos_index][0] * (ux >> 1) + s_sine_table[cos_index][1];

 

      return;  }  }; } /* namespace gr */

#endif/* INCLUDED_GR_FXPT_H */

 

i got error as follows:

/fxpt.h:42:22: error: variable ‘gr::GR_TEST_API gr::fxpt’ has initializer but incomplete type
/home/pravesh/gnuradio-3.7.11/gr-test/lib/fxpt.h:42:22: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x [enabled by default]
/home/pravesh/gnuradio-3.7.11/gr-test/lib/fxpt.h:44:5: error: expected primary-expression before ‘static’
/home/pravesh/gnuradio-3.7.11/gr-test/lib/fxpt.h:44:5: error: expected ‘}’ before ‘static’
/home/pravesh/gnuradio-3.7.11/gr-test/lib/fxpt.h:44:5: error: expected ‘,’ or ‘;’ before ‘static’
/home/pravesh/gnuradio-3.7.11/gr-test/lib/fxpt.h:46:24: error: uninitialized const ‘gr::s_sine_table’ [-fpermissive]
/home/pravesh/gnuradio-3.7.11/gr-test/lib/fxpt.h:50:3: error: expected unqualified-id before ‘public’
/home/pravesh/gnuradio-3.7.11/gr-test/lib/fxpt.h:107:1: error: expected declaration before ‘}’ token
make[2]: *** [lib/CMakeFiles/gnuradio-test.dir/fmcomm_impl.cc.o] Error 1
make[1]: *** [lib/CMakeFiles/gnuradio-test.dir/all] Error 2
make: *** [all] Error 2

Outcomes