IIRC: The "standard C" way to do this is:

In one, and only one, .cc file, do at the top level (not in any class, method, or function definition), e.g.:

int foo = 0;

then in the .h file do:

extern int foo;

and you should be able to access 'foo' from any code the includes that .h file.

On Apr 12, 2008, at 7:32 PM, Vincenzo wrote:
I'm looking for suggestions on how to implement a variable that is
shared between two blocks.
If I include the same header into the .cc files implementing my blocks
I get the "multiple definition of variable x" error.

Which is the correct way to do this?
is there an example available?


_______________________________________________
Discuss-gnuradio mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to