C++ Class in out of tree module 3.7

I am trying to add a non block C++ class to the out of tree build of
a module. I successfully compile the code but all my Python tests

File “/python/qa_test.py”, line 24, in
import example_swig as example
File “/build/swig/example_swig.py”, line 28, in
_example_swig = swig_import_helper()
File “/build/swig/example_swig.py”, line 24, in swig_import_helper
_mod = imp.load_module(’_example_swig’, fp, pathname, description)
ImportError:/build/lib/libgnuradio-example.so: undefined symbol:

I add the header and source files to the CMakeLists.txt and

What is the best practice to add such code?


Hi Andrew,
you’re probably doing everything right!
When looking at the headers of C++ block, you will notice that the
classes have a “MODULENAME_API” makro prefix. Did you use that on your

Best regards,