Dear all, I'm writing an out-of-tree C++ block performing some PSK mapping method (BPSK, QPSK. 16PSK, 256PSK). I got this error when running make command:
/home/khachoang/gr-Hoang/lib/Digital_Mapper_impl.cc:36:5: error: prototype > for ‘gr::Hoang::Digital_Mapper::sptr gr::Hoang::Digital_Mapper::make(int)’ > does not match any in class ‘gr::Hoang::Digital_Mapper’ > /home/khachoang/gr-Hoang/include/Hoang/Digital_Mapper.h:49:19: error: > candidate is: static gr::Hoang::Digital_Mapper::sptr > gr::Hoang::Digital_Mapper::make() I have tried but still do not know where this error from. Could anyone help me to fix it? My header file: #ifndef INCLUDED_HOANG_DIGITAL_MAPPER_IMPL_H > #define INCLUDED_HOANG_DIGITAL_MAPPER_IMPL_H > #include <Hoang/Digital_Mapper.h> > #include <vector> > #include <sys/time.h> > #include <stdio.h> > #include <unistd.h> > namespace gr { > namespace Hoang { > class Digital_Mapper_impl : public Digital_Mapper > { > private: > int d_mapping_mode; > std::vector<gr_complex> d_symbols_psk; > public: > Digital_Mapper_impl(int mapping_mode); > ~Digital_Mapper_impl(); > // Where all the action really happens > void forecast (int noutput_items, gr_vector_int > &ninput_items_required); > int general_work(int noutput_items, > gr_vector_int &ninput_items_v, > gr_vector_const_void_star &input_items, > gr_vector_void_star &output_items); > }; > } // namespace Hoang > } // namespace gr > #endif /* INCLUDED_HOANG_DIGITAL_MAPPER_IMPL_H */ My implementation file: #ifdef HAVE_CONFIG_H > #include "config.h" > #endif > #include <gnuradio/io_signature.h> > #include "Digital_Mapper_impl.h" > #include <cstdio> > #include <math.h> > #include <vector> > #include <sys/time.h> > namespace gr { > namespace Hoang { > Digital_Mapper::sptr > Digital_Mapper::make(int mapping_mode) > { > return gnuradio::get_initial_sptr > (new Digital_Mapper_impl(mapping_mode)); > } > Digital_Mapper_impl::Digital_Mapper_impl(int mapping_mode) > : gr::block("Digital_Mapper", > gr::io_signature::make(1, 1, sizeof(char)), > gr::io_signature::make(1, 1, sizeof(gr_complex))), > d_mapping_mode(mapping_mode), d_symbols_psk(mapping_mode,gr_complex(0,0)) > { > printf("init::Digital_Mapper\n"); > > int i = 0; > int pi = 3.14159265359 > while (i < mapping_mode) { > float theta = 2*pi*i/mapping_mode; > d_symbols_psk[i] = gr_complex(cos(theta), sin(theta)); > i++; > } > set_output_multiple(mapping_mode); > } > /* > * Our virtual destructor. > */ > Digital_Mapper_impl::~Digital_Mapper_impl() > { > } > void > Digital_Mapper_impl::forecast (int noutput_items, gr_vector_int > &ninput_items_required) > { > /* <+forecast+> e.g. ninput_items_required[0] = noutput_items */ > } > int > Digital_Mapper_impl::general_work (int noutput_items, > gr_vector_int &ninput_items_v, > gr_vector_const_void_star &input_items, > gr_vector_void_star &output_items) > { > int ninput_items = ninput_items_v[0]; > unsigned char *in = (unsigned char *) input_items[0]; > gr_complex *out = (gr_complex *) output_items[0]; > > int ni = 0; > int no = 0; > unsigned char byte = 0x0; > unsigned char exceed = d_mapping_mode - 1; > while (ni < ninput_items && no < noutput_items) > { > byte = in[ni]; > for (int i = 0;i <= 8*log(2)/log(d_mapping_mode)-1;i++) { > int pos = i*log(d_mapping_mode)/log(2); > /*if (mapping_mode == 0)*/ out[no + i] = d_symbols_psk[((byte >> pos) & > exceed)]; > } > ni++; > no += 8/log(d_mapping_mode); > } > consume_each(ni); > return no; > } > } /* namespace Hoang */ > } /* namespace gr */ My xml file: <?xml version="1.0"?> > <block> > <name>Digital Mapper</name> > <key>Hoang_Digital_Mapper</key> > <category>Hoang</category> > <import>import Hoang</import> > <make>Hoang.Digital_Mapper($mapping_mode)</make> > <param> > <name>Mapping Mode</name> > <key>mapping_mode</key> > <value>2</value> > <type>enum</type> > <option> > <name>BPSK</name> > <key>2</key> > </option> > <option> > <name>QPSK</name> > <key>4</key> > </option> > <option> > <name>16PSK</name> > <key>16</key> > </option> > <option> > <name>256PSK</name> > <key>256</key> > </option> > </param> > <sink> > <name>byte_in</name> > <type>byte</type> > </sink> > <source> > <name>sym_out</name> > <type>complex</type> > </source> > </block> Many thanks. Hoang -- *Hoang Ngo-Khac* Vietnam National University, Hanoi (VNU-H) Univ. of Engineering and Technology (UET) Faculty of Electronics and Telecommunications (FET) Alternative email: hoangnk...@vnu.edu.vn Mobilephone: +84.163.682.7874
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio