Ive looked this up on msdn and it didnt help too much,
http://msdn.microsoft.com/en-us/library/72zdcz6f(VS.80).aspx.
The error is:
1>AI.obj : error LNK2005: "class Units * Unit" (?Unit@@3PAVUnits@@A) already defined in Main.obj
1>AI.obj : error LNK2005: "class AIs * AI" (?AI@@3PAVAIs@@A) already defined in Main.obj
The offending code in AI.h (has #pragma once)
class Units
{
public:
static GType Type;
static int Attack, Defence, UnitSize, Cost, MaxLife;
static bool Exist;
} Unit[5];
class AIs {
public:
static AType Anim;
static int X, Y, Z, NX, NY, NZ, AX, AY, AZ, NAX, NAY, NAZ, Target, Life, Parent, Frame, EndFrame, Energy;
static bool Run, Tight;
} AI[AIAmount];
I tried changing the declaration to
However, even though that removes errors, it runs the game fine, but even when im trying to set variables i can see in the debugger that it cant actually find the pointer.
I also tried using structs instead, however it gives the exact same error, and exact same result when i make it static.
Is there any way i can fix this?
Thanks in advance.
(If i remove the include to AI.h in Main.cpp it works, however i need Main.cpp aswell as AI.cpp to be able to access these classes.)
Smoke me a kipper, ill be back for breakfast.