discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Using Out-of-Tree module from C++ Application


From: Michael Buettner
Subject: Re: [Discuss-gnuradio] Using Out-of-Tree module from C++ Application
Date: Fri, 17 May 2013 09:47:41 -0700

On Tue, May 14, 2013 at 10:03 AM, Tom Rondeau <address@hidden> wrote:
> On Mon, May 13, 2013 at 8:00 PM, Michael Buettner
> <address@hidden> wrote:
>> 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_ptr<gr::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

Thanks for the pointer, Tom.
I needed to add 'gnuradio-reader' to the library to target_link_libraries(...).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]