[Top][All Lists]

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

[Discuss-gnuradio] Question on how to derive a class in an out-of-tree m

From: Zhe Feng
Subject: [Discuss-gnuradio] Question on how to derive a class in an out-of-tree module based on a gnuradio class
Date: Mon, 6 Oct 2014 21:58:48 -0400

Dear all,

I'm trying to derive a packet_header2 class in my own OOT module based on gr::digital::packet_header_default. I followed the way in packet_heade_ofdm  of gr-digital and made packet_header2.h and packet_header2.cc in my own OOT module. 

But when I tried to import my_oot in python, it returned an undefined symbol error like this:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/my_oot/__init__.py", line 45, in <module>
    from my_oot_swig import *
  File "/usr/local/lib/python2.7/dist-packages/my_oot/my_oot_cdma.py", line 26, in <module>
    _my_oot_swig = swig_import_helper()
  File "/usr/local/lib/python2.7/dist-packages/cdma/cdma_swig.py", line 22, in swig_import_helper
    _mod = imp.load_module('_my_oot_swig', fp, pathname, description)
ImportError: /usr/local/lib/libgnuradio-my_oot.so: undefined symbol: _ZTIN2gr7digital21packet_header_defaultE

I searched the list and found a previous answered question below 

where Marcus suggested editing the CMakeList.txt files by adding the module I needed. So I added


and then. This above error disappeared when I import my_oot again in python. But this problem isn't solved. I tried to access some functions of packet_header_default like formatter and base, it returned me an AtrributeError like this:

AttributeError: 'packet_header2_sptr' object has no attribute 'formatter', which means the packet_header2 wasn't really a derived class of packet_header_default.

I confirmed my conjecture by checking the 
/usr/local/lib/python2.7/dist-packages/my_oot/my_oot_swig.py where the classes are stored in python.  I found that the class packet_header2 is defined as class packet_header2(object). So the packet_header2 isn't installed as a derived class of gr::digital::packet_header_default.  what I expected was packet_header2(gr::digital::packet_header_default)

So I'm asking you that how to correctly derive my class (eg: packet_header2) in my own oot module based on a class (eg: packet_header_default) in an existing module (eg: gr-digital)?

My packet_header2.h and packet_header2.cc are attached for your reference. 


Zhe Feng 

Electrical Engineering: System 
University of Michigan Ann Arbor 

Attachment: packet_header2.cc
Description: Text Data

Attachment: packet_header2.h
Description: Text Data

reply via email to

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