Hello everyone
I'm writing an input managing class, and I've stumbled upon a problem right now. I've been trying to fix it for a long time, but I just don't see the problem. It's probably a minor detail (like always.. -.-), but I would really apreciate it if someone could take a look at it.
The error I'm getting is:
Error 13 error LNK2001: unresolved external symbol "private: static struct Input::Keyinfo * Input::KeyinfoArr" (?KeyinfoArr@Input@@0PAUKeyinfo@1@A) C:\Nick\D3D projects\DVD\Code\Chapter 25 Character Animation\SkinnedMesh\InputManager.obj
[source lang="cpp"]header file:struct Input{//...some codepublic: enum Action{ MOVEFORWARD, MOVEBACKWARD, STRAFELEFT, STRAFERIGHT, JUMP}; static bool AllowAction(Action action);private: //...some code static const int ACTIONCOUNT = 5; // amount of possible controls/actions struct Keyinfo { Action action; int code; // virtual-key code associated with action bool pressed; bool down; }; static Keyinfo KeyinfoArr[ACTIONCOUNT];};cpp file://...some codebool Input::AllowAction(Action action){ for (int i = 0; i < ACTIONCOUNT; ++i) { if (KeyinfoArr[i].action == action) {if ((KeyinfoArr[i].action == Action::MOVEFORWARD ||KeyinfoArr[i].action == Action::MOVEBACKWARD ||KeyinfoArr[i].action == Action::STRAFELEFT ||KeyinfoArr[i].action == Action::STRAFELEFT)&& KeyinfoArr[i].down) return true; if (KeyinfoArr[i].action == Action::MOVEFORWARD && KeyinfoArr[i].pressed) return true; } } return false;}[/source]
'Unresolved external symbol' when using static struct in static method
Started by Nick C., Nov 11 2012 09:39 AM
3 replies to this topic






