Original Post
i have a single header file that i want to declare globals in as they'll be used in multiple files (using extern seemed to cause linker errors in the first place) here's how the header is set up: and i've included this library in 2 cpp files. but no, once again i'm getting linker errors saying it's already been defined in another file surely the ifdefs are meant to stop stuff like that happening? or are they not too reliable? i must be missing something, im tired and probably not thinking too straight, anyone know what's going on and how i can allow other files to use this library without getting unresolved externals?
#ifndef GLOBALS_H
#define GLOBALS_H
typedef struct Entity {
vector <Route> route;
int nPos[2];
int nTarget[2];
bool bDead;
bool bAtTarget;
} Entity;
Entity Prey;
#endif
Quote:many thanks for any help or suggestions people can give
GAI fatal error LNK1169: one or more multiply defined symbols found GAI error LNK2005: "struct Entity Prey" (?Prey@@3UEntity@@A) already defined in AStar.obj