# C++ Class in out of tree module 3.7

**URL:** <https://www.ruby-forum.com/t/c-class-in-out-of-tree-module-3-7/233004>\
**Category:** GNU Radio\
**Created:** [November 10, 2014, 8:38pm UTC](https://www.ruby-forum.com/t/c-class-in-out-of-tree-module-3-7/233004 "2014-11-10T20:38:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [November 10, 2014, 8:38pm UTC](https://www.ruby-forum.com/t/c-class-in-out-of-tree-module-3-7/233004/1 "2014-11-10T20:38:46Z")

</div>

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  
fail.

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:  
\_ZTIN2gr15example

I add the header and source files to the CMakeLists.txt and  
example\_swig.i

What is the best practice to add such code?

–  
Andrew

---

<div class="post-metadata">

**Author:** ![Andrew\_Burger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8c91f0/32.png) [@Andrew\_Burger](https://www.ruby-forum.com/u/Andrew_Burger)\
**Post date:** [November 10, 2014, 8:58pm UTC](https://www.ruby-forum.com/t/c-class-in-out-of-tree-module-3-7/233004/2 "2014-11-10T20:58:28Z")

</div>

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  
class?

Best regards,  
Marcus
