[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Shared varible between blocks
From: |
Michael Dickens |
Subject: |
Re: [Discuss-gnuradio] Shared varible between blocks |
Date: |
Sat, 12 Apr 2008 20:28:40 -0400 |
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?