Hey, Guys
I encountered a programming problem when I tried to build a new block. I
defined a subclass inside my block class, which looks like:
class my_block : gr_block{
class my_subclass {
sub_class details
}
}
Well, this my_subclass is part of my implementation, all its member
functions are inline functions. Everything got compiled and installed
well.
However, when I used my block in my python script, I met some error
like:
import _howto
ImportError: /usr/local/lib/python2.5/site-packages/gnuradio/_howto.so:
undefined symbol: _ZN22howto_my_block10my_subclass1hE
Could anybody help me with this problem? Should I do something with my
.i
file or makefile.am file?
Thank you in advance.
Dawei
On Thu, Sep 13, 2007 at 02:54:16PM -0400, Dawei Shen wrote:
Thank you in advance.
Dawei
SWIG doesn’t deal with nested C++ classes.
This is a known limitation, and apparently hard to fix.
In your case, I doubt that the python code needs to know anything
about the implementation details, including the nested class.
I suggest trying to remove the nested class from the .i file.
Eric
Hi, Eric
I didn’t put the nested class in the .i file, only the upper-level block
class, which produced the error (adding it doesn’t solve it either).
Maybe I
just shouldn’t nest C++ classes when I use SWIG? Thank you.
Dawei
On Thu, Sep 13, 2007 at 03:10:17PM -0400, Dawei Shen wrote:
Hi, Eric
I didn’t put the nested class in the .i file, only the upper-level block
class, which produced the error (adding it doesn’t solve it either). Maybe I
just shouldn’t nest C++ classes when I use SWIG? Thank you.
Dawei
OK, then I don’t think this is a swig problem.
Do you have a virtual destructor defined for your class?
Is it inline, or in the .cc file? It should be in the .cc file.
Eric