Passing Blocks to C++

I have created a block in c++ which needs to retune after a certain
of samples have passed through. To accomplish this I am passing a
uhd_usrp_sink block to my block from python and then I am attempting to
retune after a certain number of samples. The block compiles correctly
it runs fine unless I have the retune code in the block. If I attempt
retune from c++ I get this message on trying to import the module:

Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/lib/python2.7/dist-packages/gr_my/”, line
from gr_my_swig import *
File “/usr/local/lib/python2.7/dist-packages/gr_my/”,
24, in
_gr_my_swig = swig_import_helper()
File “/usr/local/lib/python2.7/dist-packages/gr_my/”,
20, in swig_import_helper
_mod = imp.load_module(’_gr_my_swig’, fp, pathname, description)
ImportError: /usr/local/lib64/ undefined
symbol: _ZN3uhd14tune_request_tC1Ed

This does not happen if I do not include the line:
sink->set_center_freq((double) ooinfo2[trannumber + 3]);

I am sending my c++ block the usrp sink block through the constructor:
gr_my_amplifier_ff::gr_my_amplifier_ff (std::vector<gr_complex> pre,
std::vector ooinfo, float sps,boost::shared_ptr<uhd_usrp_sink>

I have tried the fix listed in the FAQ and I have tried including all of
the following headers in the .i file:
#include <gr_uhd_usrp_sink.h>
#include <gr_uhd_api.h>
#include “uhd/types/time_spec.hpp”
#include <uhd/types/time_spec.hpp>
#include “boost/thread/thread.hpp”
#include <boost/make_shared.hpp>
#include <uhd/convert.hpp>

also i have tried including:
%include “uhd_swig.i”

The block compiles and runs fine if I don’t try to access this boost
pointer so I don’t understand why it is not working.


On 01/12/2012 08:50 PM, Joshua Stahl wrote:

File “/usr/local/lib/python2.7/dist-packages/gr_my/”, line 40,

Its a missing symbol. Try linking your library against libuhd.