I have a base class Enemy and a derived class Fly (Fly is a type of enemy). Enemy has a static float pointer called spiderTrans:
static float *spiderTrans;
In my main, I create a spider and a fly and try to assign a value to the fly's spiderTrans:
spider = new Spider("./data","spider.png",50.0,50.0);
fly = new Fly("./data","wasp.png",30.0,40.0);
fly->spiderTrans = spider->trans;
(spider has an array of floats called trans)
I get a link error when I try to build:
Webz.obj : error LNK2001: unresolved external symbol "public: static float * Enemy::spiderTrans" (?spiderTrans@Enemy@@2PAMA)
Debug/webz.exe : fatal error LNK1120: 1 unresolved externals
but if I change the variable so that it's not static, it builds fine.
????
I thought the only thing that static meant was that all Enemy's that are created share the same spiderTrans variable.
Thanks for any help!
-Adam
static float *spiderTrans;
In my main, I create a spider and a fly and try to assign a value to the fly's spiderTrans:
spider = new Spider("./data","spider.png",50.0,50.0);
fly = new Fly("./data","wasp.png",30.0,40.0);
fly->spiderTrans = spider->trans;
(spider has an array of floats called trans)
I get a link error when I try to build:
Webz.obj : error LNK2001: unresolved external symbol "public: static float * Enemy::spiderTrans" (?spiderTrans@Enemy@@2PAMA)
Debug/webz.exe : fatal error LNK1120: 1 unresolved externals
but if I change the variable so that it's not static, it builds fine.
????
I thought the only thing that static meant was that all Enemy's that are created share the same spiderTrans variable.
Thanks for any help!
-Adam