S
Stefan
Hi,
I am trying to get my structure to be externed so I can use it in all
my
projects source files, but the code is generating errors. Here is some
of my
code:
"Globals.cpp"
typedef struct SPECKEY {
bool BeenUsed;
bool Pressed;
bool On;
} specialkey;
#include "globals.h"
specialkey IsShift, IsAlt, IsMod1, IsMod2, IsMod3; // line 24.
....
"Globals.h"
....
extern specialkey IsAlt;
extern specialkey IsShift;
extern specialkey IsMod1;
extern specialkey IsMod2;
extern specialkey IsMod3;
....
It generates the following errors:
Globals.h(77): error C2146: syntax error : missing ';' before
identifier
'IsAlt'
Globals.h(77): error C2501: 'IsAlt' : missing storage-class or type
specifiers
etc...
And the same errors for the other extern lines. I have tried leaving
out the
'specialkey' bit of the extern lines, but that generates the following
errors:
KeyEventSink.cpp(142): error C2228: left of '.On' must have
class/struct/union type
KeyEventSink.cpp(143): error C2228: left of '.Pressed' must have
class/struct/union
type
Globals.cpp(24): error C2371: 'IsShift' : redefinition; different basic
types
etc...
Does anyone know how I can make a structure externed without generating
errors? Thanks.
I am trying to get my structure to be externed so I can use it in all
my
projects source files, but the code is generating errors. Here is some
of my
code:
"Globals.cpp"
typedef struct SPECKEY {
bool BeenUsed;
bool Pressed;
bool On;
} specialkey;
#include "globals.h"
specialkey IsShift, IsAlt, IsMod1, IsMod2, IsMod3; // line 24.
....
"Globals.h"
....
extern specialkey IsAlt;
extern specialkey IsShift;
extern specialkey IsMod1;
extern specialkey IsMod2;
extern specialkey IsMod3;
....
It generates the following errors:
Globals.h(77): error C2146: syntax error : missing ';' before
identifier
'IsAlt'
Globals.h(77): error C2501: 'IsAlt' : missing storage-class or type
specifiers
etc...
And the same errors for the other extern lines. I have tried leaving
out the
'specialkey' bit of the extern lines, but that generates the following
errors:
KeyEventSink.cpp(142): error C2228: left of '.On' must have
class/struct/union type
KeyEventSink.cpp(143): error C2228: left of '.Pressed' must have
class/struct/union
type
Globals.cpp(24): error C2371: 'IsShift' : redefinition; different basic
types
etc...
Does anyone know how I can make a structure externed without generating
errors? Thanks.