Forum: GNU Radio SWIG Includes for GRExtras blocks

Posted by Roy Thompson (Guest)
on 2012-11-11 16:16
(Received via mailing list)
I am trying to write a C++ block that uses the GRExtras block
interface, but am having some difficulty figuring out how to include
the proper headers in my swig.i file.  If I use GR_SWIG_BLOCK_MAGIC2
along with my block name, I get the following error when building
swig:

error: InputItems was not declared in this scope

I have also tried directly including block.h in the swig.i file and
including various .i files from GRExtras, but I can't seem to find the
proper includes to get it to compile.  What is the proper syntax for
doing this?

Thanks,
Roy
Posted by Josh Blum (Guest)
on 2012-11-11 19:20
(Received via mailing list)
On 11/11/2012 07:15 AM, Roy Thompson wrote:
> I am trying to write a C++ block that uses the GRExtras block
> interface, but am having some difficulty figuring out how to include
> the proper headers in my swig.i file.  If I use GR_SWIG_BLOCK_MAGIC2
> along with my block name, I get the following error when building
> swig:
>
> error: InputItems was not declared in this scope

I guess the work function is exposed in your interface header? That
should be ok, but you will either need to %ignore your_block::work or
%include <gnuradio/block.h>

>
> I have also tried directly including block.h in the swig.i file and
> including various .i files from GRExtras, but I can't seem to find the
> proper includes to get it to compile.  What is the proper syntax for
> doing this?
>

Try adding these includes to the top of your file

#define GR_EXTRAS_API
%include <gnuradio.i>
%include "extras_factory.i"
%include <gnuradio/block.h>

Post the error w./ swig .i file if its not working:

-josh
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.