# Getting error: prototype for does not match any in class

**URL:** <https://www.ruby-forum.com/t/getting-error-prototype-for-does-not-match-any-in-class/230257>\
**Category:** GNU Radio\
**Created:** [June 6, 2014, 6:02pm UTC](https://www.ruby-forum.com/t/getting-error-prototype-for-does-not-match-any-in-class/230257 "2014-06-06T18:02:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jason\_sam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7993a0/32.png) [@jason\_sam](https://www.ruby-forum.com/u/jason_sam)\
**Post date:** [June 6, 2014, 6:02pm UTC](https://www.ruby-forum.com/t/getting-error-prototype-for-does-not-match-any-in-class/230257/1 "2014-06-06T18:02:39Z")

</div>

Hello,

I am writing my own signal processing block to calculate |x1|^2+|x2|^2  
where x1 and x2 are complex. But I am getting below error

[5%] Building CXX object  
lib/CMakeFiles/gnuradio-testmodule.dir/power2\_cf\_impl.cc.o  
/home/cogwsn/GRProject/gr-testmodule/lib/power2\_cf\_impl.cc:32:5:\* error:  
prototype for\* ‘gr::testmodule::power2\_cf::sptr  
gr::testmodule::power2\_cf::make(size\_t)’ _does not match any in class_  
‘gr::testmodule::power2\_cf’  
/home/cogwsn/GRProject/gr-testmodule/include/testmodule/power2\_cf.h:49:19:  
error: candidate is: static gr::testmodule::power2\_cf::sptr  
gr::testmodule::power2\_cf::make()  
/home/cogwsn/GRProject/gr-testmodule/lib/power2\_cf\_impl.cc:41:5: error:  
prototype for ‘gr::testmodule::power2\_cf\_impl::power2\_cf\_impl(size\_t)’  
does  
not match any in class ‘gr::testmodule::power2\_cf\_impl’  
/home/cogwsn/GRProject/gr-testmodule/lib/power2\_cf\_impl.h:29:11: error:  
candidates are: gr::testmodule::power2\_cf\_impl::power2\_cf\_impl(const  
gr::testmodule::power2\_cf\_impl&)  
/home/cogwsn/GRProject/gr-testmodule/lib/power2\_cf\_impl.h:35:7:  
error: gr::testmodule::power2\_cf\_impl::power2\_cf\_impl()  
/home/cogwsn/GRProject/gr-testmodule/lib/power2\_cf\_impl.cc: In member  
function ‘virtual int gr::testmodule::power2\_cf\_impl::work(int,  
gr\_vector\_const\_void\_star&, gr\_vector\_void\_star&)’:  
/home/cogwsn/GRProject/gr-testmodule/lib/power2\_cf\_impl.cc:67:34: error:  
‘d\_vlen’ was not declared in this scope  
/home/cogwsn/GRProject/gr-testmodule/lib/power2\_cf\_impl.cc:74:46: error:  
cannot convert ‘float’ to ‘float\*’ in argument passing  
/home/cogwsn/GRProject/gr-testmodule/lib/power2\_cf\_impl.cc:75:46: error:  
cannot convert ‘float’ to ‘float\*’ in argument passing  
/home/cogwsn/GRProject/gr-testmodule/lib/power2\_cf\_impl.cc:76:44: error:  
‘volk\_32fc\_x2\_multiply\_32fc’ was not declared in this scope  
/home/cogwsn/GRProject/gr-testmodule/lib/power2\_cf\_impl.cc:78:39: error:  
‘volk\_32f\_x2\_add\_32f’ was not declared in this scope  
make[2]: \*\*\*  
[lib/CMakeFiles/gnuradio-testmodule.dir/power2\_cf\_impl.cc.o]  
Error 1  
make[1]: \*\*\* [lib/CMakeFiles/gnuradio-testmodule.dir/all] Error 2

Please let me where I am doing mistakes. Below is the code.

#ifdef HAVE\_CONFIG\_H  
#include “config.h”  
#endif

#include \<gr\_io\_signature.h\>  
#include “power2\_cf\_impl.h”  
#include \<volk/volk.h\>  
namespace gr {  
namespace testmodule {

```
power2_cf::sptr power2_cf::make(size_t vlen)
{
  return gnuradio::get_initial_sptr(new power2_cf_impl(size_t 

```

vlen));  
}

```
/*
 * The private constructor
 */
power2_cf_impl::power2_cf_impl(size_t vlen)
  : gr_sync_block("power2_cf",
          gr_make_io_signature(1, 2, sizeof(gr_complex)*vlen),
          gr_make_io_signature(1, 1, sizeof(float)*vlen)),

```

d\_vlen(vlen)  
{  
const int alignment\_multiple =  
volk\_get\_alignment() / sizeof(float);  
set\_alignment(std::max(1,alignment\_multiple));  
}

```
/*
 * Our virtual destructor.
 */
power2_cf_impl::~power2_cf_impl()
{
}

int
power2_cf_impl::work(int noutput_items,
          gr_vector_const_void_star &input_items,
          gr_vector_void_star &output_items)
{
   const gr_complex *in1 = (const gr_complex *) input_items[0];
   const gr_complex *in2 = (const gr_complex *) input_items[1];
   float *out = (float *) output_items[0];
   int noi = noutput_items * d_vlen;
    // Do <+signal processing+>

float x1=0;
float x2=0;
float x3=0;
float x4=0;
   volk_32fc_magnitude_32f_u(x1, in1, noi);
   volk_32fc_magnitude_32f_u(x2, in2, noi);
volk_32fc_x2_multiply_32fc(x3, x1, x1, noi);
volk_32fc_x2_multiply_32fc(x4, x2, x2, noi);
 volk_32f_x2_add_32f(out, x3, x4, noi);
    // Tell runtime system how many output items we produced.
    return noutput_items;
}

```

} /\* namespace testmodule _/  
} /_ namespace gr \*/

Regards,  
Kunal

---

<div class="post-metadata">

**Author:** ![kunal\_sankhe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/9e8a1a/32.png) [@kunal\_sankhe](https://www.ruby-forum.com/u/kunal_sankhe)\
**Post date:** [June 6, 2014, 8:37pm UTC](https://www.ruby-forum.com/t/getting-error-prototype-for-does-not-match-any-in-class/230257/2 "2014-06-06T20:37:38Z")

</div>

On 06/06/2014 06:00 PM, kunal sankhe wrote:

> gr::testmodule::power2\_cf  
> /home/cogwsn/GRProject/gr-testmodule/include/testmodule/power2\_cf.h:49:19:  
> error: candidate is: static gr::testmodule::power2\_cf::sptr  
> gr::testmodule::power2\_cf::make()

Kunal,

This error message is telling you all you need to know: Compare the  
definition and declaration of the make() function, and you’ll see  
they’re different.

> gr\_vector\_const\_void\_star&, gr\_vector\_void\_star&):  
> /home/cogwsn/GRProject/gr-testmodule/lib/power2\_cf\_impl.cc:67:34: error:  
> d\_vlen was not declared in this scope  
> /home/cogwsn/GRProject/gr-testmodule/lib/power2\_cf\_impl.cc:74:46: error:  
> cannot convert float to float\* in argument passing

Likewise, this error message is very explicit. The function takes  
float\*, and you pass float. Check the function signature.

A word of caution: If you’re writing C++ blocks with VOLK accelerators,  
you should be very fluent in C++ (pointers, too) and familiar with your  
compiler of choice.

If you are still learning, that’s fine, of course! But maybe you should  
start with something a bit simpler.

Cheers,  
M
