Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

unresolved extern

Status
Not open for further replies.

joeGrammar

Programmer
Jun 4, 2001
162
CA
Does anyone know why a header file such as

xxx.h

with code such as:

extern const INDICATOR
eIndFalse,
eIndTrue,
eIndNo,
eIndYes;

and included in

yyy.c

and eIndTrue is referenced a few times...

Anyways does anyone know why this would compile fine, but cause an unresolved external at link time? and yes the .h file is included in the project. Also its a dll being built, is it a function of the "extern"?


 
Did you declare these in another file?

extern const INDICATOR
eIndFalse,
eIndTrue,
eIndNo,
eIndYes;

I have not worked with extern TOO much but I belive they need to be declared globally in file N. I dont think you need to individually declare each extern so I would check to make sure these are declared.

Matt
 
extern means a declaration of a variable what is implemented in other place. This variable must exist without the specificator extern in one place and must exist in only one single place. In the place whare variable is declared without extern, in this place variable is implemented. If you don't do it, you'll get a inker error. With extern you can declare in every places how many times would you like. John Fill
1c.bmp


ivfmd@mail.md
 
So let me get this straight...

there should be another file/place, global which has this:

const INDICATOR
eIndFalse,
eIndTrue,
eIndNo,
eIndYes;

and then it would be ok for xxx.h to say:

extern const INDICATOR
eIndFalse,
eIndTrue,
eIndNo,
eIndYes;


is this true?
 
yes, but please declare each variable in a different declaration. John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top