Hi everyone,
I'm finishing a code for a NEC uProcessor and I'm having problems with unions. At the beginning of writing this code I wrote everything in 1 file, but after I decided to divide this code in various modules.
I have some unions that are used in different modules, so I have to declare them as 'extern', right?
The question is that I don't know how to do that...
What I've done is:
In "global.h"
extern __saddr union bts
{ unsigned char byte;
struct
{ unsigned char b0:1;
unsigned char b1:1;
unsigned char b2:1;
unsigned char b3:1;
unsigned char b4:1;
unsigned char b5:1;
unsigned char b6:1;
unsigned char b7:1;
};
} bits1, bits2, bits3, bits4, digi0, digi1;
****************
In other modules, I include "global.h" and the error I get when I use 'bits1', 'bits2' or another one is:
"Undefined external 'bits1' referred in module.c" which is a logical error, but I don't know how to solve this...
I'm finishing a code for a NEC uProcessor and I'm having problems with unions. At the beginning of writing this code I wrote everything in 1 file, but after I decided to divide this code in various modules.
I have some unions that are used in different modules, so I have to declare them as 'extern', right?
The question is that I don't know how to do that...
What I've done is:
In "global.h"
extern __saddr union bts
{ unsigned char byte;
struct
{ unsigned char b0:1;
unsigned char b1:1;
unsigned char b2:1;
unsigned char b3:1;
unsigned char b4:1;
unsigned char b5:1;
unsigned char b6:1;
unsigned char b7:1;
};
} bits1, bits2, bits3, bits4, digi0, digi1;
****************
In other modules, I include "global.h" and the error I get when I use 'bits1', 'bits2' or another one is:
"Undefined external 'bits1' referred in module.c" which is a logical error, but I don't know how to solve this...