Hi Dave,

Thanks for your reply. Actually I figured out the problem. After going through 
the files of the already existing blocks, especially the CMakeLists.txt, I 
figured out where I need to add my own header files. I added entries of all the 
class files in the CMakeLists.txt inside “lib” folder. I am not sure if this 
has solved the problem, but at least it is compiling now. Currently I am facing 
the problem of how to make the GnuRadio compiler to get the C++11 flag. I know 
it has to be added to the CMake file, but I am not sure where exactly. If 
anyone knows about this, then kindly let me know. I also need to include other 
libraries like pthread, libboost_filesystem, etc.

Thanks and Regards,
Pranav

Von: Dave NotTelling [mailto:dmp250...@gmail.com]
Gesendet: Dienstag, 23. August 2016 18:50
An: Pranav Padalkar
Cc: discuss-gnuradio@gnu.org
Betreff: Re: [Discuss-gnuradio] Attribute error: and support with external 
class and header files

I've had bad luck just putting my own headers in OOT modules.  The way I do 
things now is to use gr_modtool add and select 'noblock'.  Then just remove the 
grc XML file created.  Seems that YourModuleName_API is needed before structs 
and classes or it doesn't get seen by Swig.  Could be wrong about that.  Might 
just work for me on a fluke =\

On Tue, Aug 23, 2016 at 6:47 AM, Pranav Padalkar 
<pranav.padal...@esk.fraunhofer.de<mailto:pranav.padal...@esk.fraunhofer.de>> 
wrote:

Hello all,



I have written a c++ code and I wish to implement as a block in GNURadio. I 
created a module (named "newblocks") and a block (named "my_client) and made 
appropriate changes. The thing is, I have many class and header files for my 
c++ code, for eg. Protobuf. I put those files in a folder called "client" 
inside "include" folder of my module (gr-newblocks/include/newblocks/client). 
It showed no error during cmake, make, make install and ldconfig. But when I 
put the block in the flowgraph and run it, it gives me following error.



File "/home/sdr/workspace/develop/Pranav/USRP_client/usrp_client.py", line 115, 
in __init__
    self.newblocks_my_client_0 = newblocks.my_client("123", "8080")
AttributeError: 'module' object has no attribute 'my_client'



I already had a working block in the same module, which I had created earlier. 
And now even that block gives me same error. If I don't use any of the two 
blocks, the flowgraph works fine.



I, then, also added a CMakeLists.txt file in that "client" folder and entered 
all the .h and .c files in the text file. I added the entry for "client" folder 
in the "Add subdirectories" part of the CMakeLists.txt in (gr-newblocks/ ). Is 
there anything else I need to do in order to use my own class and header files? 
Do I also need to put the .o files along with the header and class files? I 
tried with both, putting the .o files and not putting them, it still shows the 
same error.

I even created a new module and a new block and copy pasted my code and header 
and class files. I still get the same error. I kindly ask for help in this 
regard. I am using Ubuntu 14.04 LTS, GnuRadio 3.7.9.2, I am using a lot of 
Boost 1.61.



Thank you in advance.

Best Regards,
Pranav Padalkar
Fraunhofer-Institut für Eingebettete Systeme und Kommunikationstechnik ESK


_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org<mailto:Discuss-gnuradio@gnu.org>
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to