[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Getting error: prototype for does not match any i
From: |
Martin Braun |
Subject: |
Re: [Discuss-gnuradio] Getting error: prototype for does not match any in class |
Date: |
Fri, 06 Jun 2014 20:36:15 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 |
On 06/06/2014 06:00 PM, kunal sankhe wrote:
> 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()
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.
> /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
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
> /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
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>