I am trying to use an out of tree module (built according to the
“Out-of-tree modules” documentation) from a C++ application. The
module is named “reader”, and the block I’m trying to use is
“command_gate_cc”.
I can use it from python with:
from reader import reader_swig
…
cg_block = reader_swig.command_gate_cc_make()
I can’t figure out how to create a command_gate_cc block in C++ though.
/usr/local/lib/libgnuradio-reader.so exists, and ‘nm -CD
/usr/local/lib/libgnuradio-reader.so’ gives me
‘0000000000004850 T gr::reader::command_gate_cc::make()’
/usr/include/reader_command_gate_cc.h exists:
namespace gr {
namespace reader {
class READER_API command_gate_cc : virtual public gr_block
{
public:
typedef boost::shared_ptr<command_gate_cc> sptr;
static sptr make();
};
} // namespace reader
} // namespace gr
My CC applications has:
#include <command_gate_cc.h>
…
boost::shared_ptrgr::reader::command_gate_cc cg =
gr::reader::command_gate_cc::make();
But I get the linker error:
undefined reference to `gr::reader::command_gate_cc::make()’
What am I missing? I don’t understand the build system well enough to
figure out where if that is where I’m going wrong. Any help would be
appreciated. Thanks!
On Mon, May 13, 2013 at 8:00 PM, Michael Buettner
[email protected] wrote:
I can’t figure out how to create a command_gate_cc block in C++ though.
class READER_API command_gate_cc : virtual public gr_block
#include <command_gate_cc.h>
…
boost::shared_ptrgr::reader::command_gate_cc cg =
gr::reader::command_gate_cc::make();
I think you’re pretty close.
First, you can use the sptr from the class itself:
gr::reader::command_gate_cc::sptr = gr::reader::command_gate_cc::make();
But I get the linker error:
undefined reference to `gr::reader::command_gate_cc::make()’
What am I missing? I don’t understand the build system well enough to
figure out where if that is where I’m going wrong. Any help would be
appreciated. Thanks!
Looks like you aren’t linking properly to your libgnuradio-reader.so.
Take a look at gr-audio/examples/c++/CMakeLists.txt for how you can
set up a cmake file properly.
Tom
On Tue, May 14, 2013 at 10:03 AM, Tom R. [email protected] wrote:
cg_block = reader_swig.command_gate_cc_make()
namespace reader {
Tom
Thanks for the pointer, Tom.
I needed to add ‘gnuradio-reader’ to the library to
target_link_libraries(…).
Hello everyone, it has been few days I’m on GNU and is totally new for
me. I’m very much familiar with c++ and I’ve created few blocks also
so, if you can help me on the
programming architect, variable declaration and assigning them
values,function declaration and making a multiple input & output blocks.