Quesition Signal Processing Block: Compilation Errors Regarding Multiple Definition

I have a question.

I am trying to make 4 signal processing blocks wherein some of the
definitions for its computations will be REPEATEDLY defined. I really
this. However, basing from the gr-howto module (of which I used the
dependencies there), the compiler ALWAYS COMPLAINS of a multiple
of something that I REALLY INTEND to define repeatedly. This is due to
fact that the four signal processing blocks that I made share some
signal processing manipulations.

I want to be able to ignore this error and compile the four signal
processing blocks simultaneously. Is this possible with GNU Radio?


In short, could I change the g++ compilation rules? How do I do this?


On Mon, Jan 14, 2008 at 07:40:26PM +0800, Jonas wrote:

I want to be able to ignore this error and compile the four signal
processing blocks simultaneously. Is this possible with GNU Radio?


Don’t define the function multiple times, define it once, and include
it in the shared library that you build for the swig module.
E.g., in the “howto” example, create a new file
my_shared_functions.cc, and add it to _howto_la_SOURCES.

If this doesn’t make sense, you may want to read up on shared
libraries, automake and libtool.



I’ll try this.


I still have the same problem. Actually, I am just including header
files of my own design. And as par your suggesstion, I decided to
include them in a file called divcom_shared_func.cc.

In short divcom_shared_func.cc contains only the following lines that
are needed by my other signal processing blocks:

#include “others.cc”
#include “elem_matrix.cc”
using elem_matrix_jonas::elem_matrix;

And the functions defined in these files are all repeatedly used.

Unfortunately, I still get the same errors regarding multiple

So what do I do now?


You need to understand the basics of compiling and linking. Otherwise
you’re going to keep taking blind shots in the dark that won’t work.
You could spend an hour learning and understanding it, or hours on top
of hours guessing and waiting for others to attempt to fix things for
you… which many people won’t have the patience or will to do :slight_smile:

At the very least, you could simply look at some of the other code in
GNU Radio and follow the guides. There are many, many examples. You
don’t include .cc files, you include header files. Then you must link
properly. If you don’t understand what I mean by this, take Eric’s
suggestion and start reading up on shared libraries, compiling, and
linking. Once you do this, you will understand why you keep getting
multiple definition errors.

  • George

By the way, when I defined divcom_shared_func.cc in only ONE of the
files, the other files won’t compile successfully complaining that
some functions are NOT yet defined.

And so I’m forced to define divcom_shared_func.cc in all the other
files. Doing this results in my original problem… So what do I do?