|
From: | Michael Bassi |
Subject: | GNU Radio Companion Error for Custom OOT cpp block |
Date: | Sun, 24 Nov 2019 23:05:32 +0000 |
Hi all,
I have created my first custom OOT block in c++
It works when my block takes no inputs.
However, after changing my block signature to allow one input variable (called samp_rate), I am getting the following error in GRC:
self.custom_blocks_readfilesource_cpp_0 = custom_blocks.readfilesource_cpp(samp_rate)
TypeError: make() takes no arguments (1 given)
As you can see, my block is called "readfilesource_cpp"
I have updated the make function in readfilesoure_cpp.h like so:
static sptr make(float input_sample_rate = 1.0);
I have updated the make function and constructor in my "readfilesource_cpp_impl.cpp" file like so:
readfilesource_cpp::sptr
readfilesource_cpp::make(float input_sample_rate) {
return gnuradio::get_initial_sptr (new readfilesource_cpp_impl(input_sample_rate));
}
/* The private constructor */
readfilesource_cpp_impl::readfilesource_cpp_impl(float input_sample_rate)
: gr::sync_block("readfilesource_cpp",gr::io_signature::make(0, 0, 0),gr::io_signature::make(1, 1, sizeof(float))),
sample_rate(input_sample_rate)
{}
I downloaded the gnu radio source code from github and compared the char_to_float block to my own. I can't see why mine isn't working.
Cheers,
Mike
p.s.
Why are there two header files for a block? why is _impl automatically added to my files by gr_modtool?
|
[Prev in Thread] | Current Thread | [Next in Thread] |