Question about set_output_multiple


I’m trying to create a block whose number of outputs is the number of
inputs, which i’m setting as a parameter of the block(named tamano),+ n,
being n a parameter of the block too.
For example, if i use a vector sources block of size 16 as the input of
block, and n = 3, the output should be of size 19.
According to what i have read, i should use the set_output_multiple() to
achieve this.

Problem 1:
But i don’t know what is the correct way to do this, or where to set it.
I was doing it by writing: set_output_multiple(int tamano + n) at the
constructor, but i’m having an error: error: expected primary-expression
before ‘int’.

Problem 2:
I am trying to create this block with a c++ code and i don’t know how to
SWIG, i don’t know if i should convert the c++ code into a python code
SWIG and then copy it into the .cpp file generated, or if i copy the c++
code into it and then SWIG converts it to a python code using some
in the terminal.

Could the problem 1 has something to do with the fact that I am trying
create this block with a c++ code?

Thank you very much.


View this message in context:
Sent from the GnuRadio mailing list archive at

Hello David,

Problem 1:

your “error: expected…” looks like there’s something small wrong with
your C++ syntax; would you mind sharing the code of your constructor (or
at least the signature and the lines containing set_output_multiple)?
Generally, “int tamano” declares the variable tamano as integere – I
think you might be fine if you just delete the “int”.

Problem 2:
SWIG can be hard. But usually, if you created the stub for your block
using “gr_modtool add”, then everything will be alright, and all the
methods defined in include/your_block_name.h will be available to
python, as long as they are easily wrappable (this mostly means that you
used basic parameter types only).

Best regards,

Hello Marcus

Thank you for your response

Before, I was setting the set_output_multiple at the constructor in the
file and i was getting the error I said before
Then, I set it in the .h file and I had no error.

Is it correct to set it in the .h file? Here are both the .cc and the .

In the .cc file, the set_output_multiple is commented.


Also, I set: int n;
ninput_items_required[0] = noutput_items - n;
at the forecast method. I did this for the reason i explained before; If
have for example 16 items at the in put, i need to have 16 + n items at
output. Is this configured right?

Another question: This is about the ninput_items. How should I set it
my requirements? I suppose this ninput_items should depend of “tamano”,
which is the size of the input stream.
Should I use ninput_items instead of tamano in the code? And if this
should I set set_output_multiple(int ninput_items + n) instead of
set_output_multiple(int tamano + n)?

PD: In the .cc file you can take a look at the c++ code for the chaotic
coding if you like. And if you are interested, i can send you the c++
that gives those values of “zmean3”, “zmean6”, “secuencias3” and
“secuencias6” and the paper where the theory of this coding method is

Thank you very much.


View this message in context:
Sent from the GnuRadio mailing list archive at

Hi David,
yes, your .cc verified: your C++ was just syntactically incorrect:

   void set_output_multiple(int tamano + n);

won’t work. To call a method or function, you don’t use it’s full
signature, but just its name with the parameters filled in, so that line
must read

and you should then not implement a output_multiple nested function
(this won’t have any effect, by the way).

Also, I set: int n;
ninput_items_required[0] = noutput_items - n;
This will define a local variable “n” which hides the parameter “n” that
you get; remove the “int n;” line! If you need “n” to be saved from your
constructors call, you must define it in the header and assign the
class’s “n” in the constructor. You do that wrong for “tamano”, too.

To be completely honest, you seem to be a little lost when it comes to
C++; maybe you should look a bit harder at how other blocks in GNU
Radio’s source code tree do that (you can use “grep -r ‘pattern’ .” in
your GNU Radio source code tree to find things like occurences of
set_output_multiple) and more importantly read a C++ tutorial before
diving right into GNU Radio.

Best regards,

I thought I was doing it well.

Thank you Marcus, I will read then.


View this message in context:
Sent from the GnuRadio mailing list archive at