problem with code installation

It is a block for gnuradio for phase shifting modulation.

"make" tells me:


In file included from howto_diffconst_bc.cc:5:
./howto_diffconst_bc.h:6: error: expected identifier before ‘.’ token
./howto_diffconst_bc.h:6: error: expected ‘;’ before ‘.’ token
./howto_diffconst_bc.h:6: error: expected unqualified-id before ‘.’ token
howto_diffconst_bc.cc:12: error: expected initializer before ‘<’ token
howto_diffconst_bc.cc:13: error: expected initializer before ‘<’ token
howto_diffconst_bc.cc:14: error: expected constructor, destructor, or type conversion before ‘<’ token
howto_diffconst_bc.cc: In constructor ‘howto_diffconst_bc::howto_diffconst_bc()’:
howto_diffconst_bc.cc:19: error: ‘phase’ was not declared in this scope
howto_diffconst_bc.cc:19: error: ‘complex’ was not declared in this scope
howto_diffconst_bc.cc:19: error: expected primary-expression before ‘float’
howto_diffconst_bc.cc:19: error: expected ‘;’ before ‘float’
howto_diffconst_bc.cc: In member function ‘virtual int howto_diffconst_bc::general_work(int, gr_vector_int&, gr_vector_const_void_star&, gr_vector_void_star&)’:
howto_diffconst_bc.cc:30: error: ‘complex’ was not declared in this scope
howto_diffconst_bc.cc:30: error: expected primary-expression before ‘float’
howto_diffconst_bc.cc:30: error: expected ‘;’ before ‘float’
howto_diffconst_bc.cc:33: error: ‘phase’ was not declared in this scope
howto_diffconst_bc.cc:33: error: ‘p_change’ was not declared in this scope
howto_diffconst_bc.cc:35: error: ‘phase’ was not declared in this scope
howto_diffconst_bc.cc:35: error: ‘n_change’ was not declared in this scope
howto_diffconst_bc.cc:37: error: ‘out’ was not declared in this scope
howto_diffconst_bc.cc:37: error: ‘phase’ was not declared in this scope
make[2]: *** [howto_diffconst_bc.lo] Error 1
make[2]: Leaving directory `/home/thunderbolt/Desktop/modulator/lib'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/thunderbolt/Desktop/modulator'
make: *** [all] Error 2


As far as I understand - it doesn't recognise complex, or I declared phase, n_change and p_change somewhere I shouldn't have. Please help me sort this out.


howto_diffconst.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef INCLUDED_HOWTO_DIFFCONST_BC_H
#define INCLUDED_HOWTO_DIFFCONST_BC_H

#include <gr_block.h>
#include <complex>
using namespace.std;

class howto_diffconst_bc;

typedef boost::shared_ptr<howto_diffconst_bc> howto_diffconst_bc_sptr;

howto_diffconst_bc_sptr howto_make_diffconst_bc ();

class howto_diffconst_bc : public gr_block
{
  private:
    friend howto_diffconst_bc_sptr howto_make_diffconst_bc ();
    howto_diffconst_bc ();
  public:
    ~howto_diffconst_bc ();
    int general_work (int noutput_items, gr_vector_int &ninput_items,
                      gr_vector_const_void_star &input_items,
                      gr_vector_void_star &output_items);
};

#endif 




howto_diffconst.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <howto_diffconst_bc.h>
#include <gr_io_signature.h>
#include <complex>

howto_diffconst_bc_sptr howto_make_diffconst_bc ()
     {return howto_diffconst_bc_sptr (new howto_diffconst_bc ());}

static const complex<float> p_change =(0.0, 1.0);
static const complex<float> n_change =(0.0,-1.0);
complex<float> phase;

howto_diffconst_bc::howto_diffconst_bc (): gr_block ("diffconst_bc",
                                           gr_make_io_signature (1, 1, 1),
                                           gr_make_io_signature (1, 1, 8))
     {phase = complex<float> (1.0, 0.0);}

howto_diffconst_bc::~howto_diffconst_bc () {}


int howto_diffconst_bc::general_work (int noutput_items, gr_vector_int &ninput_items,
                                      gr_vector_const_void_star &input_items,
                                      gr_vector_void_star &output_items)

{
const int      *in  = (const int *)      input_items[0];
complex<float> *out = (complex<float> *) output_items[0];

if (in[0]%2==1)
  {phase*=p_change;}
else
  {phase*=n_change;}

out[0]=phase;

consume_each (noutput_items);
return noutput_items;
}
Please don't post your question in multiple forums.
Topic archived. No new replies allowed.